* test/ruby/test_file_exhaustive.rb
(TestFileExhaustive#test_expand_path*): refactoring. split the method into some chunks of the same kind of tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ac37fc37b1
commit
b361d7d082
@ -1,3 +1,9 @@
|
|||||||
|
Tue Aug 7 10:46:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* test/ruby/test_file_exhaustive.rb
|
||||||
|
(TestFileExhaustive#test_expand_path*): refactoring. split the method
|
||||||
|
into some chunks of the same kind of tests.
|
||||||
|
|
||||||
Tue Aug 7 00:31:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Aug 7 00:31:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* class.c (rb_special_singleton_class_of): utility function.
|
* class.c (rb_special_singleton_class_of): utility function.
|
||||||
|
@ -409,6 +409,9 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||||||
else
|
else
|
||||||
assert_equal("/foo", File.expand_path('/foo'))
|
assert_equal("/foo", File.expand_path('/foo'))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_expand_path_encoding
|
||||||
drive = (DRIVE ? 'C:' : '')
|
drive = (DRIVE ? 'C:' : '')
|
||||||
if Encoding.find("filesystem") == Encoding::CP1251
|
if Encoding.find("filesystem") == Encoding::CP1251
|
||||||
a = "#{drive}/\u3042\u3044\u3046\u3048\u304a".encode("cp932")
|
a = "#{drive}/\u3042\u3044\u3046\u3048\u304a".encode("cp932")
|
||||||
@ -425,6 +428,10 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||||||
assert_equal(expected.force_encoding(cp), File.expand_path(a.dup.force_encoding(cp)), cp)
|
assert_equal(expected.force_encoding(cp), File.expand_path(a.dup.force_encoding(cp)), cp)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
assert_incompatible_encoding {|d| File.expand_path(d)}
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_expand_path_home
|
||||||
assert_kind_of(String, File.expand_path("~")) if ENV["HOME"]
|
assert_kind_of(String, File.expand_path("~")) if ENV["HOME"]
|
||||||
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
|
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
|
||||||
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") }
|
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") }
|
||||||
@ -440,7 +447,6 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||||||
ensure
|
ensure
|
||||||
ENV["HOME"] = home
|
ENV["HOME"] = home
|
||||||
end
|
end
|
||||||
assert_incompatible_encoding {|d| File.expand_path(d)}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_basename
|
def test_basename
|
||||||
|
Loading…
x
Reference in New Issue
Block a user