зеркало из https://github.com/github/ruby.git
test_scanner_events.rb: assert_location
* test/ripper/test_scanner_events.rb (TestRipper#assert_location): rename so skipped in backtraces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b8bcd92059
Коммит
4dfd373905
|
@ -90,28 +90,28 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_location
|
def test_location
|
||||||
validate_location ""
|
assert_location ""
|
||||||
validate_location " "
|
assert_location " "
|
||||||
validate_location "@"
|
assert_location "@"
|
||||||
validate_location "\n"
|
assert_location "\n"
|
||||||
validate_location "\r\n"
|
assert_location "\r\n"
|
||||||
validate_location "\n\n\n\n\n\r\n\n\n"
|
assert_location "\n\n\n\n\n\r\n\n\n"
|
||||||
validate_location "\n;\n;\n;\n;\n"
|
assert_location "\n;\n;\n;\n;\n"
|
||||||
validate_location "nil"
|
assert_location "nil"
|
||||||
validate_location "@ivar"
|
assert_location "@ivar"
|
||||||
validate_location "1;2;3"
|
assert_location "1;2;3"
|
||||||
validate_location "1\n2\n3"
|
assert_location "1\n2\n3"
|
||||||
validate_location "1\n2\n3\n"
|
assert_location "1\n2\n3\n"
|
||||||
validate_location "def m(a) nil end"
|
assert_location "def m(a) nil end"
|
||||||
validate_location "if true then false else nil end"
|
assert_location "if true then false else nil end"
|
||||||
validate_location "BEGIN{print nil}"
|
assert_location "BEGIN{print nil}"
|
||||||
validate_location "%w(a b\nc\r\nd \ne )"
|
assert_location "%w(a b\nc\r\nd \ne )"
|
||||||
validate_location %Q["a\nb\r\nc"]
|
assert_location %Q["a\nb\r\nc"]
|
||||||
validate_location "print(<<""EOS)\nheredoc\nEOS\n"
|
assert_location "print(<<""EOS)\nheredoc\nEOS\n"
|
||||||
validate_location "print(<<-\"EOS\")\nheredoc\n EOS\n"
|
assert_location "print(<<-\"EOS\")\nheredoc\n EOS\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_location(src)
|
def assert_location(src)
|
||||||
buf = ''
|
buf = ''
|
||||||
Ripper.lex(src).each do |pos, type, tok|
|
Ripper.lex(src).each do |pos, type, tok|
|
||||||
line, col = *pos
|
line, col = *pos
|
||||||
|
|
Загрузка…
Ссылка в новой задаче