diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-10 10:42:52 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-10 10:42:52 +0000 |
commit | 4ed65f12427b34e7362ce878ac1ef1b4b4fa6bbd (patch) | |
tree | e37c22f864c5d29ea21608c2be67ac66eb87abd4 /test/ruby | |
parent | f194d4411ddba995c5a6ccc858a6d17f6f22807a (diff) | |
download | ruby-4ed65f12427b34e7362ce878ac1ef1b4b4fa6bbd.tar.gz |
io.c: path name conversion at ARGF
* io.c (argf_next_argv): the standard conversion to path name
should take place.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_argf.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index a112cf3e84..26fe16061e 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -316,6 +316,34 @@ class TestArgf < Test::Unit::TestCase } end + def test_inplace_to_path + base = "argf-test" + name = "#{@tmpdir}/#{base}" + File.write(name, "foo") + stdout = $stdout + argf = ARGF.class.new(Struct.new(:to_path).new(name)) + begin + result = argf.gets + ensure + $stdout = stdout + argf.close + end + assert_equal("foo", result) + end + + def test_inplace_ascii_incompatible_path + base = "argf-\u{30c6 30b9 30c8}" + name = "#{@tmpdir}/#{base}" + File.write(name, "foo") + stdout = $stdout + argf = ARGF.class.new(name.encode(Encoding::UTF_16LE)) + assert_raise(Encoding::CompatibilityError) do + argf.gets + end + ensure + $stdout = stdout + end + def test_encoding ruby('-e', "#{<<~"{#"}\n#{<<~'};'}", @t1.path, @t2.path, @t3.path) do |f| {# |