summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file.rb2
-rw-r--r--test/ruby/test_io.rb6
-rw-r--r--test/zlib/test_zlib.rb4
3 files changed, 9 insertions, 3 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index 669b004b83..409d21fc4e 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -527,7 +527,7 @@ class TestFile < Test::Unit::TestCase
io.write "foo"
io.flush
assert_equal 3, io.size
- assert_raise(IOError) { io.path }
+ assert_nil io.path
ensure
io&.close
end
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 0bf24960c6..5ea9a8e574 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1639,6 +1639,12 @@ class TestIO < Test::Unit::TestCase
end
end
+ def test_explicit_path
+ io = IO.for_fd(0, path: "Fake Path", autoclose: false)
+ assert_match %r"Fake Path", io.inspect
+ assert_equal "Fake Path", io.path
+ end
+
def test_write_nonblock_simple_no_exceptions
pipe(proc do |w|
w.write_nonblock('1', exception: false)
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index 00a13af95b..f57b7f2730 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -804,10 +804,10 @@ if defined? Zlib
io.rewind
gz0 = Zlib::GzipWriter.new(io)
- assert_raise(NoMethodError) { gz0.path }
+ assert_nil gz0.path
gz1 = Zlib::GzipReader.new(io)
- assert_raise(NoMethodError) { gz1.path }
+ assert_nil gz1.path
gz0.close
gz1.close
end