diff options
Diffstat (limited to 'test/ruby/test_file.rb')
-rw-r--r-- | test/ruby/test_file.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index 26f68df958..b888233bbe 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -260,4 +260,14 @@ class TestFile < Test::Unit::TestCase assert_equal(File.chmod(0666, file), 1, bug5671) end end + + def test_open_nul + Dir.mktmpdir(__method__.to_s) do |tmpdir| + path = File.join(tmpdir, "foo") + assert_raise(ArgumentError) do + open(path + "\0bar", "w") {} + end + refute File.exist?(path) + end + end end |