diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-09-20 08:42:00 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-09-20 08:42:00 +0000 |
commit | 2c750e368d28af3a14a4e2ab1f7cb20244a41838 (patch) | |
tree | 2ec5881e01d632d76147ceffee390c362349a5e6 /test/ripper | |
parent | b2a700f13eb406145983ff2f2308ce0f6b1ebbe5 (diff) | |
download | ruby-2c750e368d28af3a14a4e2ab1f7cb20244a41838.tar.gz |
* test/ripper/test_scanner_events.rb: tokens must be reordered.
* ext/ripper/lib/ripper/tokenizer.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper')
-rw-r--r-- | test/ripper/test_scanner_events.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb index 8a8efbb168..5a2d4e9bf5 100644 --- a/test/ripper/test_scanner_events.rb +++ b/test/ripper/test_scanner_events.rb @@ -20,11 +20,11 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase def parse @tokens = [] super - @tokens + @tokens.sort_by {|tok,pos| pos }.map {|tok,| tok } end def on__scan(type, tok) - @tokens.push tok if !@target or type == @target + @tokens.push [tok,[lineno(),column()]] if !@target or type == @target end end @@ -80,7 +80,8 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase def validate_location(src) data = PosInfo.new(src).parse buf = '' - data.each do |tok, type, line, col| + data.sort_by {|tok, type, line, col| [line,col] }\ + .each do |tok, type, line, col| assert_equal buf.count("\n") + 1, line, "wrong lineno: #{tok.inspect} (#{type}) [#{line}:#{col}]" assert_equal buf.sub(/\A.*\n/m, '').size, col, |