diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-20 08:25:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-20 08:25:03 +0000 |
commit | 40e477f05c78f64d22377ee2bac52d146596851d (patch) | |
tree | 4a71a2838d258197aee63a23371721f11423700b /test/ruby/test_argf.rb | |
parent | a1140a3ebff3fcd9940e2777a22e8a060d3500df (diff) | |
download | ruby-40e477f05c78f64d22377ee2bac52d146596851d.tar.gz |
io.c: update argf lineno
* io.c (argf_rewind): rewind line number in non-global ARGF
instance.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_argf.rb')
-rw-r--r-- | test/ruby/test_argf.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index 5c3805ca19..fdd31c630a 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -78,15 +78,15 @@ class TestArgf < Test::Unit::TestCase p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["2", 2, "2", 2] a.rewind b.rewind - p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["1", 1, "1", 3] - p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["2", 2, "2", 4] - p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["3", 3, "3", 5] - p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["4", 4, "4", 6] - p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["5", 5, "5", 7] + p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["1", 1, "1", 1] + p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["2", 2, "2", 2] + p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["3", 3, "3", 3] + p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["4", 4, "4", 4] + p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["5", 5, "5", 5] a.rewind b.rewind - p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["5", 5, "5", 8] - p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["6", 6, "6", 9] + p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["5", 5, "5", 5] + p [a.gets.chomp, a.lineno, b.gets.chomp, b.lineno] #=> ["6", 6, "6", 6] SRC end @@ -144,6 +144,9 @@ class TestArgf < Test::Unit::TestCase assert_equal(3, f.lineno) assert_equal((1..3).map {|i| [i, "#{i}\n"]}, result) + f.rewind + assert_equal(2, f.lineno) + f = ARGF.class.new(@t1.path, @t2.path, @t3.path) f.each_char.to_a assert_equal(0, f.lineno) |