Skip to content

Commit b4b6365

Browse files
committed
Add test for Kernel#readlines
1 parent 122d484 commit b4b6365

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/stdlib/Kernel_test.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,4 +561,25 @@ def test_raise
561561
end
562562
end
563563
end
564+
565+
def test_readlines
566+
$stdin = File.open(__FILE__)
567+
568+
assert_send_type(
569+
"() -> Array[String]",
570+
JustKernel.new, :readlines
571+
)
572+
573+
with_int(3) do |limit|
574+
with_string(",") do |separator|
575+
$stdin = File.open(__FILE__)
576+
assert_send_type(
577+
"(string, int, chomp: bool) -> Array[String]",
578+
JustKernel.new, :readlines, ",", 3, chomp: true
579+
)
580+
end
581+
end
582+
ensure
583+
$stdin = STDIN
584+
end
564585
end

0 commit comments

Comments
 (0)