diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-24 08:38:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-24 08:38:01 +0000 |
commit | 1758ff03819ce2c699345a4299f6fecdd25f8c0b (patch) | |
tree | 1f9d18b037b61c1e46776fd7c86915e82eb249b6 /test | |
parent | 9240eb3dfe10f4948f85b7abd0c57e2192d6550f (diff) | |
download | ruby-1758ff03819ce2c699345a4299f6fecdd25f8c0b.tar.gz |
file.c: exception message encoding
* file.c (rb_file_expand_path_internal): preserve the file name
encoding in an exception message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 3394d12372..219d357cf2 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -669,6 +669,19 @@ class TestFileExhaustive < Test::Unit::TestCase assert_raise(ArgumentError, bug) { File.expand_path("~anything") } end if DRIVE + def test_expand_path_error_for_nonexistent_username + user = "\u{3086 3046 3066 3044}:\u{307F 3084 304A 3046}" + assert_raise_with_message(ArgumentError, /#{user}/) {File.expand_path("~#{user}")} + end unless DRIVE + + def test_expand_path_error_for_non_absolute_home + old_home = ENV["HOME"] + ENV["HOME"] = "./UserHome" + assert_raise_with_message(ArgumentError, /non-absolute home/) {File.expand_path("~")} + ensure + ENV["HOME"] = old_home + end + def test_expand_path_raises_a_type_error_if_not_passed_a_string_type assert_raise(TypeError) { File.expand_path(1) } assert_raise(TypeError) { File.expand_path(nil) } |