aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-12-08 18:19:53 +1300
committerGitHub <noreply@github.com>2022-12-08 18:19:53 +1300
commit6fd5d2dc003bda5ce0685abd2b975d7ac7079d46 (patch)
treea7cffd3b1b2f40b76511d785b5c00f3d35245ee6 /test/ruby
parentb2764752b2bccb8e4574891d380d0f0a3d67add0 (diff)
downloadruby-6fd5d2dc003bda5ce0685abd2b975d7ac7079d46.tar.gz
Introduce `IO.new(..., path:)` and promote `File#path` to `IO#path`. (#6867)
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_file.rb2
-rw-r--r--test/ruby/test_io.rb6
2 files changed, 7 insertions, 1 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)