ruby-changes:3114
From: ko1@a...
Date: 24 Dec 2007 20:37:04 +0900
Subject: [ruby-changes:3114] akr - Ruby:r14606 (trunk): add tests.
akr 2007-12-24 20:36:48 +0900 (Mon, 24 Dec 2007)
New Revision: 14606
Modified files:
trunk/test/ruby/test_m17n.rb
Log:
add tests.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_m17n.rb?r1=14606&r2=14605
Index: test/ruby/test_m17n.rb
===================================================================
--- test/ruby/test_m17n.rb (revision 14605)
+++ test/ruby/test_m17n.rb (revision 14606)
@@ -657,6 +657,16 @@
assert_nothing_raised { eval(u(%{/\\u{6666}#{}\\xc2\\xa0/})) }
end
+ def test_str_allocate
+ s = String.allocate
+ assert_equal(Encoding::ASCII_8BIT, s.encoding)
+ end
+
+ def test_str_String
+ s = String(10)
+ assert_equal(Encoding::ASCII_8BIT, s.encoding)
+ end
+
def test_str_new
STRINGS.each {|s|
t = String.new(s)
@@ -1873,4 +1883,31 @@
assert_equal(e("\xc2\xa1"), me.name)
assert_equal(u("\xc2\xa1"), mu.name)
end
+
+ def test_symbol
+ s1 = "\xc2\xa1".force_encoding("euc-jp").intern
+ s2 = "\xc2\xa1".force_encoding("utf-8").intern
+ assert_not_equal(s1, s2)
+ end
+
+ def test_chr
+ 0.upto(255) {|b|
+ assert_equal([b].pack("C"), b.chr)
+ }
+ end
+
+ def test_marshal
+ STRINGS.each {|s|
+ m = Marshal.dump(s)
+ t = Marshal.load(m)
+ assert_equal(s, t)
+ }
+ end
+
+ def test_env
+ ENV.each {|k, v|
+ assert_equal(Encoding::ASCII_8BIT, k.encoding)
+ assert_equal(Encoding::ASCII_8BIT, v.encoding)
+ }
+ end
end
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml