summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-29 09:19:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-29 09:19:15 +0000
commitdaa622aed079b4434e607820d7577b4a7d4f2bfc (patch)
tree5a7cfc28983ed2e26680686bc23eb47de95fa813 /test
parentdeff2a3e247d9dd42ac55d9ecfeb7f567aac9fd4 (diff)
* time.c (time_strftime): format should be ascii compatible.
* parse.y (rb_intern3): non ASCII compatible symbols. * re.c (rb_reg_regsub): add encoding check. * string.c (rb_str_chomp_bang): ditto. * test/ruby/test_utf16.rb (TestUTF16::test_chomp): raises exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_utf16.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/ruby/test_utf16.rb b/test/ruby/test_utf16.rb
index bd56377734..1647563f84 100644
--- a/test/ruby/test_utf16.rb
+++ b/test/ruby/test_utf16.rb
@@ -132,13 +132,21 @@ EOT
end
def test_hex
- s1 = "f\0f\0".force_encoding("utf-16le")
- assert_equal(255, s1.hex, "#{encdump s1}.hex")
+ assert_raise(ArgumentError) {
+ "ff".encode("utf-16le").hex
+ }
+ assert_raise(ArgumentError) {
+ "ff".encode("utf-16be").hex
+ }
end
def test_oct
- assert_equal(077, "77".encode("utf-16le").oct)
- assert_equal(077, "77".encode("utf-16be").oct)
+ assert_raise(ArgumentError) {
+ "77".encode("utf-16le").oct
+ }
+ assert_raise(ArgumentError) {
+ "77".encode("utf-16be").oct
+ }
end
def test_count
@@ -224,7 +232,9 @@ EOT
def test_chomp
s = "\1\n".force_encoding("utf-16be")
- assert_str_equal(s, s.chomp, "#{encdump s}.chomp")
+ assert_raise(ArgumentError, "#{encdump s}.chomp") {
+ s.chomp
+ }
end
def test_succ