summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-26 07:37:25 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-26 07:37:25 +0000
commit3e0becb42d73be66cd60a0694554eb014b1b6552 (patch)
tree7f1c7ee30ab35b8ff1aa80f042e7774c19f4d97a /test
parentcb0a4c0f6231639dab11d50b21614cbea019e5d4 (diff)
* io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_argf.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb
index 3c78ef4a1f..a58b70db52 100644
--- a/test/ruby/test_argf.rb
+++ b/test/ruby/test_argf.rb
@@ -770,4 +770,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