summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurdetteLamar <[email protected]>2024-01-19 17:03:20 +0000
committerPeter Zhu <[email protected]>2024-01-20 10:27:19 -0500
commit366b14c0cd850d07f11b7c2f13d0456ece1c1036 (patch)
treed92fd094b16dc35837264f7e0b55b5ce04f66938
parent99d6e2f1eeeea66b22b9bd68a4aaa2fdb881036b (diff)
More tests
-rw-r--r--test/ruby/test_argf.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb
index 12f7d6485a..fed1bf88b4 100644
--- a/test/ruby/test_argf.rb
+++ b/test/ruby/test_argf.rb
@@ -1140,4 +1140,40 @@ class TestArgf < Test::Unit::TestCase
argf.close
end
end
+
+ def test_putc
+ t = make_tempfile0("argf-#{__method__}")
+ t.puts 'bar'
+ t.close
+ ruby('-pi-', '-e', "print ARGF.putc('x')", t.path) do |f|
+ end
+ assert_equal("xxbar\n", File.read(t.path))
+ end
+
+ def test_puts
+ t = make_tempfile0("argf-#{__method__}")
+ t.puts 'bar'
+ t.close
+ ruby('-pi-', '-e', "print ARGF.puts('foo')", t.path) do |f|
+ end
+ assert_equal("foo\nbar\n", File.read(t.path))
+ end
+
+ def test_print
+ t = make_tempfile0("argf-#{__method__}")
+ t.puts 'bar'
+ t.close
+ ruby('-pi-', '-e', "print ARGF.print('foo')", t.path) do |f|
+ end
+ assert_equal("foobar\n", File.read(t.path))
+ end
+
+ def test_printf
+ t = make_tempfile0("argf-#{__method__}")
+ t.puts 'bar'
+ t.close
+ ruby('-pi-', '-e', "print ARGF.printf('%s', 'foo')", t.path) do |f|
+ end
+ assert_equal("foobar\n", File.read(t.path))
+ end
end