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 | 88580a377ced57c1275f3622fc686c46458e92b6 (patch) | |
| tree | 2ec5881e01d632d76147ceffee390c362349a5e6 /test/ripper | |
| parent | 6834045fc5d4b303947fbc5423e6601177886e6e (diff) | |
| download | ruby-88580a377ced57c1275f3622fc686c46458e92b6.tar.gz ruby-88580a377ced57c1275f3622fc686c46458e92b6.tar.xz ruby-88580a377ced57c1275f3622fc686c46458e92b6.zip | |
* test/ripper/test_scanner_events.rb: tokens must be reordered.
* ext/ripper/lib/ripper/tokenizer.rb: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/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 8a8efbb16..5a2d4e9bf 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, |
