From a583f4206210cfccd9228d6f1f0cef0f2fdb5b92 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 16 Oct 2012 02:27:07 +0000 Subject: file.c: ASCII-compatible * file.c (rb_file_join): check nul-byte only for strings, since FilePathStringValue() does it. [ruby-core:48012] [Bug #7168] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_file_exhaustive.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index f697488192..10d04ddf15 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -793,6 +793,18 @@ class TestFileExhaustive < Test::Unit::TestCase bug7168 = '[ruby-core:48012]' names = %w"a b".map {|s| s.encode(Encoding::UTF_16LE)} assert_raise(Encoding::CompatibilityError, bug7168) {File.join(*names)} + assert_raise(Encoding::CompatibilityError, bug7168) {File.join(names)} + + a = Object.new + b = names[1] + names = [a, "b"] + a.singleton_class.class_eval do + define_method(:to_path) do + names[1] = b + "a" + end + end + assert_raise(Encoding::CompatibilityError, bug7168) {File.join(names)} end def test_truncate -- cgit v1.2.3