summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-08 08:50:56 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-08 08:50:56 +0000
commit88566f08b7f9294706b6ef786cd6d57bd6aa5e5c (patch)
tree1af1d0434b15cf77cab045e19f10eed5649df416 /test
parentd8665830b746d0f1c4f622a9a90a0c6568e13e20 (diff)
* file.c (append_fspath): filesystem encoding is prior to the encoding
of argument. * file.c (rb_file_expand_path_internal, EXPAND_PATH_BUFFER): ignore the encoding of the given path name, use filesystem encoding always instead. [ruby-dev:39393] [Bug #2154] * test/ruby/test_file_exhaustive.rb: removed 2.0 spec tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file_exhaustive.rb41
-rw-r--r--test/ruby/test_require.rb2
2 files changed, 2 insertions, 41 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 44b454a773..f3c36aa38b 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -1,3 +1,4 @@
+# -*- coding: us-ascii -*-
require "test/unit"
require "fileutils"
require "tmpdir"
@@ -412,46 +413,6 @@ class TestFileExhaustive < Test::Unit::TestCase
end
end
- def test_expand_path_encoding
- drive = (DRIVE ? 'C:' : '')
- if Encoding.find("filesystem") == Encoding::CP1251
- a = "#{drive}/\u3042\u3044\u3046\u3048\u304a".encode("cp932")
- else
- a = "#{drive}/\u043f\u0440\u0438\u0432\u0435\u0442".encode("cp1251")
- end
- assert_equal(a, File.expand_path(a))
- a = "#{drive}/\225\\\\"
- if File::ALT_SEPARATOR == '\\'
- [%W"cp437 #{drive}/\225", %W"cp932 #{drive}/\225\\"]
- else
- [["cp437", a], ["cp932", a]]
- end.each do |cp, expected|
- assert_equal(expected.force_encoding(cp), File.expand_path(a.dup.force_encoding(cp)), cp)
- end
-
- path = "\u3042\u3044\u3046\u3048\u304a".encode("EUC-JP")
- assert_equal("#{Dir.pwd}/#{path}".encode("CP932"), File.expand_path(path).encode("CP932"))
-
- path = "\u3042\u3044\u3046\u3048\u304a".encode("CP51932")
- assert_equal("#{Dir.pwd}/#{path}", File.expand_path(path))
-
- assert_incompatible_encoding {|d| File.expand_path(d)}
- end
-
- def test_expand_path_encoding_filesystem
- home = ENV["HOME"]
- ENV["HOME"] = "#{DRIVE}/UserHome"
-
- path = "~".encode("US-ASCII")
- dir = "C:/".encode("IBM437")
- fs = Encoding.find("filesystem")
-
- assert_equal fs, File.expand_path(path).encoding
- assert_equal fs, File.expand_path(path, dir).encoding
- ensure
- ENV["HOME"] = home
- end
-
def test_expand_path_home
assert_kind_of(String, File.expand_path("~")) if ENV["HOME"]
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index 9efd828bf2..58a9ee26b6 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -350,7 +350,7 @@ class TestRequire < Test::Unit::TestCase
$: << tmp
open(File.join(tmp, "foo.rb"), "w") {}
require "foo"
- assert_equal(tmp.encoding, $"[0].encoding, bug6377)
+ assert_not_equal(Encoding::ASCII_8BIT, $"[0].encoding, bug6377)
}
ensure
$:.replace(loadpath)