summaryrefslogtreecommitdiff
path: root/test/-ext-/string
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-07 06:02:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-07 06:02:21 +0000
commit8a0ab36db160331190299a5b6e5483b8b47e98e2 (patch)
treed0de197b515204411fddf8a23333ac92c9410d70 /test/-ext-/string
parent548497d545b72aa3a73ee7514cc4aacbe1c7536e (diff)
file.c: skip invalid byte
* file.c (rb_str_normalize_ospath): skip invalid byte sequence not to loop infinitely. this case usually does not happen as the input name should come from real file systems. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/string')
-rw-r--r--test/-ext-/string/test_normalize.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/-ext-/string/test_normalize.rb b/test/-ext-/string/test_normalize.rb
index 283ca93..83bbfd3 100644
--- a/test/-ext-/string/test_normalize.rb
+++ b/test/-ext-/string/test_normalize.rb
@@ -59,7 +59,6 @@ class Test_StringNormalize < Test::Unit::TestCase
assert_equal expected, result,
"#{expected.dump} is expected but #{src.dump}"
end
- rescue NotImplementedError
end
def test_not_normalize_kc
@@ -79,7 +78,6 @@ class Test_StringNormalize < Test::Unit::TestCase
assert_equal src, result,
"#{src.dump} is expected not to be normalized, but #{result.dump}"
end
- rescue NotImplementedError
end
def test_dont_normalize_hfsplus
@@ -101,6 +99,11 @@ class Test_StringNormalize < Test::Unit::TestCase
assert_equal src, result,
"#{src.dump} is expected not to be normalized, but #{result.dump}"
end
- rescue NotImplementedError
end
-end
+
+ def test_invalid_sequence
+ assert_separately(%w[-r-test-/string/string], <<-'end;')
+ assert_equal("\u{fffd}", Bug::String.new("\xff").normalize_ospath)
+ end;
+ end
+end if Bug::String.method_defined?(:normalize_ospath)