diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-02-04 17:25:09 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-02-04 17:25:09 +0000 |
commit | 828c5ec400ccac53fec11f6d00e9ac6edec65685 (patch) | |
tree | 2b2899d7eb6576c3414cc6403c6c0b176984bac5 | |
parent | 41cd3d868de66ff407dd6f3c9a4126ac1692575f (diff) | |
download | ruby-828c5ec400ccac53fec11f6d00e9ac6edec65685.tar.gz |
* test/ripper/test_scanner_events.rb: fix test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | test/ripper/test_scanner_events.rb | 18 |
2 files changed, 13 insertions, 9 deletions
@@ -1,3 +1,7 @@ +Sat Feb 5 02:24:06 2005 Minero Aoki <aamine@loveruby.net> + + * test/ripper/test_scanner_events.rb: fix test. + Fri Feb 4 18:44:35 2005 Minero Aoki <aamine@loveruby.net> * ext/ripper/lib/ripper/lexer.rb: last Lexer fix was incomplete; diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb index 57be40c4dc..0beb8c09f9 100644 --- a/test/ripper/test_scanner_events.rb +++ b/test/ripper/test_scanner_events.rb @@ -9,7 +9,7 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase def scan(target, str) sym = "on_#{target}".intern - Ripper.scan(str).select {|_,type,_| type == sym }.map {|_,_,tok| tok } + Ripper.lex(str).select {|_,type,_| type == sym }.map {|_,_,tok| tok } end def test_tokenize @@ -29,13 +29,13 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase Ripper.tokenize("\#\n\n\#\n\nnil\n") end - def test_scan + def test_lex assert_equal [], - Ripper.scan('') + Ripper.lex('') assert_equal [[[1,0], :on_ident, "a"]], - Ripper.scan('a') + Ripper.lex('a') assert_equal [[[1, 0], :on_kw, "nil"]], - Ripper.scan("nil") + Ripper.lex("nil") assert_equal [[[1, 0], :on_kw, "def"], [[1, 3], :on_sp, " "], [[1, 4], :on_ident, "m"], @@ -43,18 +43,18 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase [[1, 6], :on_ident, "a"], [[1, 7], :on_rparen, ")"], [[1, 8], :on_kw, "end"]], - Ripper.scan("def m(a)end") + Ripper.lex("def m(a)end") assert_equal [[[1, 0], :on_int, "1"], [[1, 1], :on_nl, "\n"], [[2, 0], :on_int, "2"], [[2, 1], :on_nl, "\n"], [[3, 0], :on_int, "3"]], - Ripper.scan("1\n2\n3") + Ripper.lex("1\n2\n3") assert_equal [[[1, 0], :on_heredoc_beg, "<<EOS"], [[1, 5], :on_nl, "\n"], [[2, 0], :on_tstring_content, "heredoc\n"], [[3, 0], :on_heredoc_end, "EOS"]], - Ripper.scan("<<EOS\nheredoc\nEOS") + Ripper.lex("<<EOS\nheredoc\nEOS") end def test_location @@ -81,7 +81,7 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase def validate_location(src) buf = '' - Ripper.scan(src).each do |pos, type, tok| + Ripper.lex(src).each do |pos, type, tok| line, col = *pos assert_equal buf.count("\n") + 1, line, "wrong lineno: #{tok.inspect} (#{type}) [#{line}:#{col}]" |