mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Parse source strings
This commit is contained in:
parent
268db53bf8
commit
4f3ca20741
2 changed files with 31 additions and 0 deletions
|
@ -54,4 +54,23 @@ describe Spectator::Source do
|
|||
source.to_s.should match(/^(.+?)\:(\d+)$/)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#parse" do
|
||||
it "gets the absolute path" do
|
||||
file = "foo.cr"
|
||||
path = File.expand_path(file)
|
||||
source = Spectator::Source.parse("#{file}:42")
|
||||
source.file.should eq(path)
|
||||
end
|
||||
|
||||
it "gets the relative path" do
|
||||
source = Spectator::Source.parse("foo.cr:42")
|
||||
source.path.should eq("foo.cr")
|
||||
end
|
||||
|
||||
it "gets the line number" do
|
||||
source = Spectator::Source.parse("foo.cr:42")
|
||||
source.line.should eq(42)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue