summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-09 00:31:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-09 00:31:02 +0000
commitf2723c7ad275d71b56c1d4cc3ac6ed0808dfa9c5 (patch)
tree159b14780fc1a1fc77e097376cd6befe2c483353
parentb6280a0050a48b7317acb7c8935119fb012ef729 (diff)
downloadruby-f2723c7ad275d71b56c1d4cc3ac6ed0808dfa9c5.tar.gz
ruby-f2723c7ad275d71b56c1d4cc3ac6ed0808dfa9c5.tar.xz
ruby-f2723c7ad275d71b56c1d4cc3ac6ed0808dfa9c5.zip
more tests.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--bootstraptest/test_knownbug.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/bootstraptest/test_knownbug.rb b/bootstraptest/test_knownbug.rb
index 47c188a8d..ec148ca39 100644
--- a/bootstraptest/test_knownbug.rb
+++ b/bootstraptest/test_knownbug.rb
@@ -63,3 +63,61 @@ assert_equal 'ok', %q{
s1.casecmp(s2) == 0 ? :ng : :ok
}
+assert_equal 'EUC-JP', %q{ ("\xc2\xa1 %s".force_encoding("EUC-JP") % "foo").encoding.name }
+assert_equal 'true', %q{ "\xa1\xa2\xa3\xa4".force_encoding("euc-jp")["\xa2\xa3".force_encoding("euc-jp")] == nil }
+assert_equal 'ok', %q{
+ s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
+ begin
+ s["\xb0\xa3"] = "foo"
+ :ng
+ rescue IndexError
+ :ok
+ end
+}
+
+assert_equal 'EUC-JP', %q{ "\xa3\xb0".force_encoding("EUC-JP").center(10).encoding.name }
+
+assert_equal 'ok', %q{
+ s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
+ begin
+ s.chomp("\xa3\xb4".force_encoding("shift_jis"))
+ :ng
+ rescue ArgumentError
+ :ok
+ end
+}
+
+assert_equal 'ok', %q{
+ s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
+ begin
+ s.count("\xa3\xb0".force_encoding("ascii-8bit"))
+ :ng
+ rescue ArgumentError
+ :ok
+ end
+}
+
+assert_equal 'ok', %q{
+ s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
+ begin
+ s.delete("\xa3\xb2".force_encoding("ascii-8bit"))
+ :ng
+ rescue ArgumentError
+ :ok
+ end
+}
+
+assert_equal 'ok', %q{
+ s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
+ begin
+ s.each_line("\xa3\xb1".force_encoding("ascii-8bit")) {|l| }
+ :ng
+ rescue ArgumentError
+ :ok
+ end
+}
+
+assert_equal 'true', %q{
+ s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
+ s.gsub(/\xa3\xb1/e, "z") == "\xa3\xb0z\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
+}