update.
[chise/ruby.git] / test / test-string.rb
index 2f7cc56..5303723 100755 (executable)
@@ -38,10 +38,15 @@ class TestString < Test::Unit::TestCase
   end
 
   def test_characters
   end
 
   def test_characters
-    @str = "文字列"
-    assert_equal(["文","字","列"], @str.to_a)
+    assert_equal(["文","字","列"], "文字列".to_a)
     ar = []
     ar = []
-    @str.each_char {|char| ar << char }
+    "文字列".each_char {|char| ar << char }
     assert_equal(["文","字","列"], ar)
     assert_equal(["文","字","列"], ar)
+
+    # test_map
+    str = "文字列".map_char {|ch|
+      ch+ch
+    }
+    assert_equal("文文字字列列", str)
   end
 end
   end
 end