summaryrefslogtreecommitdiff
path: root/test/ruby/test_argf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_argf.rb')
-rw-r--r--test/ruby/test_argf.rb37
1 files changed, 2 insertions, 35 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb
index e558f7648d..6262514241 100644
--- a/test/ruby/test_argf.rb
+++ b/test/ruby/test_argf.rb
@@ -998,43 +998,10 @@ class TestArgf < Test::Unit::TestCase
assert_ruby_status(["-e", "2.times {STDIN.tty?; readlines}"], "", bug5952)
end
- def test_lines
+ def test_each_codepoint
ruby('-W1', '-e', "#{<<~"{#"}\n#{<<~'};'}", @t1.path, @t2.path, @t3.path) do |f|
{#
- $stderr = $stdout
- s = []
- ARGF.lines {|l| s << l }
- p s
- };
- assert_equal("[\"1\\n\", \"2\\n\", \"3\\n\", \"4\\n\", \"5\\n\", \"6\\n\"]\n", f.read)
- end
- end
-
- def test_bytes
- ruby('-W1', '-e', "#{<<~"{#"}\n#{<<~'};'}", @t1.path, @t2.path, @t3.path) do |f|
- {#
- $stderr = $stdout
- print Marshal.dump(ARGF.bytes.to_a)
- };
- assert_equal([49, 10, 50, 10, 51, 10, 52, 10, 53, 10, 54, 10], Marshal.load(f.read))
- end
- end
-
- def test_chars
- ruby('-W1', '-e', "#{<<~"{#"}\n#{<<~'};'}", @t1.path, @t2.path, @t3.path) do |f|
- {#
- $stderr = $stdout
- print [Marshal.dump(ARGF.chars.to_a)].pack('m')
- };
- assert_equal(["1", "\n", "2", "\n", "3", "\n", "4", "\n", "5", "\n", "6", "\n"], Marshal.load(f.read.unpack('m').first))
- end
- end
-
- def test_codepoints
- ruby('-W1', '-e', "#{<<~"{#"}\n#{<<~'};'}", @t1.path, @t2.path, @t3.path) do |f|
- {#
- $stderr = $stdout
- print Marshal.dump(ARGF.codepoints.to_a)
+ print Marshal.dump(ARGF.each_codepoint.to_a)
};
assert_equal([49, 10, 50, 10, 51, 10, 52, 10, 53, 10, 54, 10], Marshal.load(f.read))
end