Skip to content

Commit 366b14c

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
More tests
1 parent 99d6e2f commit 366b14c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/ruby/test_argf.rb

+36
Original file line numberDiff line numberDiff line change
@@ -1140,4 +1140,40 @@ def test_sized_read
11401140
argf.close
11411141
end
11421142
end
1143+
1144+
def test_putc
1145+
t = make_tempfile0("argf-#{__method__}")
1146+
t.puts 'bar'
1147+
t.close
1148+
ruby('-pi-', '-e', "print ARGF.putc('x')", t.path) do |f|
1149+
end
1150+
assert_equal("xxbar\n", File.read(t.path))
1151+
end
1152+
1153+
def test_puts
1154+
t = make_tempfile0("argf-#{__method__}")
1155+
t.puts 'bar'
1156+
t.close
1157+
ruby('-pi-', '-e', "print ARGF.puts('foo')", t.path) do |f|
1158+
end
1159+
assert_equal("foo\nbar\n", File.read(t.path))
1160+
end
1161+
1162+
def test_print
1163+
t = make_tempfile0("argf-#{__method__}")
1164+
t.puts 'bar'
1165+
t.close
1166+
ruby('-pi-', '-e', "print ARGF.print('foo')", t.path) do |f|
1167+
end
1168+
assert_equal("foobar\n", File.read(t.path))
1169+
end
1170+
1171+
def test_printf
1172+
t = make_tempfile0("argf-#{__method__}")
1173+
t.puts 'bar'
1174+
t.close
1175+
ruby('-pi-', '-e', "print ARGF.printf('%s', 'foo')", t.path) do |f|
1176+
end
1177+
assert_equal("foobar\n", File.read(t.path))
1178+
end
11431179
end

0 commit comments

Comments
 (0)