From c3fcb13ce03a63d333ada192f7c1b59bb26f66d8 Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 19 Dec 2012 12:24:54 +0000 Subject: merge revision(s) 37851: [Backport #7438] * io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_argf.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index 2f1ddf5391..46e762c09a 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -756,4 +756,28 @@ class TestArgf < Test::Unit::TestCase bug5952 = '[ruby-dev:45160]' assert_ruby_status(["-e", "2.times {STDIN.tty?; readlines}"], "", bug5952) end + + def test_bytes + ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f| + print Marshal.dump(ARGF.bytes.to_a) + SRC + assert_equal([49, 10, 50, 10, 51, 10, 52, 10, 53, 10, 54, 10], Marshal.load(f.read)) + end + end + + def test_chars + ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f| + print Marshal.dump(ARGF.chars.to_a) + SRC + assert_equal(["1", "\n", "2", "\n", "3", "\n", "4", "\n", "5", "\n", "6", "\n"], Marshal.load(f.read)) + end + end + + def test_codepoints + ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f| + print Marshal.dump(ARGF.codepoints.to_a) + SRC + assert_equal([49, 10, 50, 10, 51, 10, 52, 10, 53, 10, 54, 10], Marshal.load(f.read)) + end + end end -- cgit v1.2.3