aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/enc/test_shift_jis.rb2
-rw-r--r--test/ruby/test_m17n.rb9
-rw-r--r--test/ruby/test_regexp.rb2
3 files changed, 10 insertions, 3 deletions
diff --git a/test/ruby/enc/test_shift_jis.rb b/test/ruby/enc/test_shift_jis.rb
index f81cb7801c..54ef67dd44 100644
--- a/test/ruby/enc/test_shift_jis.rb
+++ b/test/ruby/enc/test_shift_jis.rb
@@ -22,6 +22,6 @@ class TestShiftJIS < Test::Unit::TestCase
s = "あいうえお"
s << 0x82a9
assert_equal("あいうえおか", s)
- assert_raise(ArgumentError) { s << 0x82 }
+ assert_raise(RangeError) { s << 0x82 }
end
end
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index fffcab3def..7c261138ba 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1161,6 +1161,7 @@ class TestM17N < Test::Unit::TestCase
def test_str_concat
assert_equal(1, "".concat(0xA2).size)
+ assert_equal(Encoding::ASCII_8BIT, "".force_encoding("US-ASCII").concat(0xA2).encoding)
assert_equal("A\x84\x31\xA4\x39".force_encoding("GB18030"),
"A".force_encoding("GB18030") << 0x8431A439)
end
@@ -1220,6 +1221,14 @@ class TestM17N < Test::Unit::TestCase
2206368128.chr(Encoding::UTF_8)
}
assert_not_match(/-\d+ out of char range/, e.message)
+
+ assert_raise(RangeError){ 0x80.chr("US-ASCII") }
+ assert_raise(RangeError){ 0x80.chr("SHIFT_JIS") }
+ assert_raise(RangeError){ 0xE0.chr("SHIFT_JIS") }
+ assert_raise(RangeError){ 0x100.chr("SHIFT_JIS") }
+ assert_raise(RangeError){ 0xA0.chr("EUC-JP") }
+ assert_raise(RangeError){ 0x100.chr("EUC-JP") }
+ assert_raise(RangeError){ 0xA1A0.chr("EUC-JP") }
end
def test_marshal
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 1104647730..05ec477cba 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -808,8 +808,6 @@ class TestRegexp < Test::Unit::TestCase
#assert_match(/^(\ufb05)\1\1$/i, "\ufb05\ufb06st") # this must be bug...
assert_match(/^\ufb05{3}$/i, "\ufb05\ufb06st")
assert_match(/^\u03b9\u0308\u0301$/i, "\u0390")
- assert_nothing_raised { 0x03ffffff.chr("utf-8").size }
- assert_nothing_raised { 0x7fffffff.chr("utf-8").size }
end
def test_unicode_age