aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_m17n.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-11 02:31:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-11 02:31:02 +0000
commitcd463d1551bbacae2d1cc60c729f7d2121b4bbc0 (patch)
tree19bea7fb141873f9264f9b47ec7bbdacf5283862 /test/ruby/test_m17n.rb
parent32f7ad36130eb97df6cae2c9e908b8556134e60a (diff)
downloadruby-cd463d1551bbacae2d1cc60c729f7d2121b4bbc0.tar.gz
string.c: replacement and block
* string.c (rb_enc_str_scrub): only one of replacement and block is allowed. [ruby-core:79038] [Bug #13119] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r--test/ruby/test_m17n.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 44f19254dc..a16e49c27a 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1625,6 +1625,7 @@ class TestM17N < Test::Unit::TestCase
assert_equal(u("\x81"), u("a\x81c").scrub {|c| break c})
assert_raise(ArgumentError) {u("a\x81").scrub {|c| c}}
+ assert_raise(ArgumentError) {u("a").scrub("?") {|c| c}}
end
def test_scrub_widechar
@@ -1645,6 +1646,7 @@ class TestM17N < Test::Unit::TestCase
"\x00\xD8\x42\x30".force_encoding(Encoding::UTF_16LE).
scrub {|e| c = e; "?".encode(Encoding::UTF_16LE)})
assert_equal("\x00\xD8".force_encoding(Encoding::UTF_16LE), c)
+ assert_raise(ArgumentError) {"\uFFFD\u3042".encode("UTF-16BE").scrub("") {}}
end
def test_scrub_dummy_encoding