Skip to content

Commit f14d1f3

Browse files
committed
Add tests for Pathname argument for IO.binread, IO.binwrite, IO.read and IO.write
1 parent 381324b commit f14d1f3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/stdlib/IO_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class IOSingletonTest < Test::Unit::TestCase
1111
def test_binread
1212
assert_send_type "(String) -> String",
1313
IO, :binread, File.expand_path(__FILE__)
14+
assert_send_type "(Pathname) -> String",
15+
IO, :binread, Pathname(File.expand_path(__FILE__))
1416
assert_send_type "(String, Integer) -> String",
1517
IO, :binread, File.expand_path(__FILE__), 3
1618
assert_send_type "(String, Integer, Integer) -> String",
@@ -26,6 +28,8 @@ def test_binwrite
2628

2729
assert_send_type "(String, String) -> Integer",
2830
IO, :binwrite, filename, content
31+
assert_send_type "(Pathname, String) -> Integer",
32+
IO, :binwrite, Pathname(filename), content
2933
assert_send_type "(String, String, Integer) -> Integer",
3034
IO, :binwrite, filename, content, 0
3135
assert_send_type "(String, String, mode: String) -> Integer",
@@ -38,6 +42,8 @@ def test_binwrite
3842
def test_read
3943
assert_send_type "(String) -> String",
4044
IO, :read, File.expand_path(__FILE__)
45+
assert_send_type "(Pathname) -> String",
46+
IO, :read, Pathname(File.expand_path(__FILE__))
4147
assert_send_type "(String, Integer) -> String",
4248
IO, :read, File.expand_path(__FILE__), 3
4349
assert_send_type "(String, Integer, Integer) -> String",
@@ -51,6 +57,8 @@ def test_write
5157

5258
assert_send_type "(String, String) -> Integer",
5359
IO, :write, filename, content
60+
assert_send_type "(Pathname, String) -> Integer",
61+
IO, :write, Pathname(filename), content
5462
assert_send_type "(String, String, Integer) -> Integer",
5563
IO, :write, filename, content, 0
5664
assert_send_type "(String, String, mode: String) -> Integer",

0 commit comments

Comments
 (0)