Fixed missed test case.
[ruby_koans.git] / koans / about_strings.rb
index 3d9037b..771ff8b 100644 (file)
@@ -139,13 +139,6 @@ EOS
     assert_equal __, string[7..9]
   end
 
-  def test_you_can_get_a_single_character_from_a_string
-    string = "Bacon, lettuce and tomato"
-    assert_equal __, string[1]
-
-    # Surprised?
-  end
-
   in_ruby_version("1.8") do
     def test_in_ruby_1_8_single_characters_are_represented_by_integers
       assert_equal __, ?a
@@ -156,12 +149,32 @@ EOS
   end
 
   in_ruby_version("1.9") do
-    def test_in_ruby_1_8_single_characters_are_represented_by_strings
+    def test_in_ruby_1_9_single_characters_are_represented_by_strings
       assert_equal __, ?a
       assert_equal __, ?a == 97
     end
   end
 
+in_ruby_version("1.8") do
+    def test_in_ruby_1_8_you_can_get_a_single_character_from_a_string
+      string = "Bacon, lettuce and tomato"
+      assert_equal __, string[1]
+
+      # Surprised?
+    end
+  end
+  
+  in_ruby_version("1.9") do
+
+    def test_in_ruby_1_9_you_can_get_a_single_character_from_a_string
+      string = "Bacon, lettuce and tomato"
+      assert_equal "__", string[1]
+
+      # Surprised?
+    end
+  end
+
+
   def test_strings_can_be_split
     string = "Sausage Egg Cheese"
     words = string.split
@@ -174,12 +187,20 @@ EOS
     assert_equal [__, __, __, __], words
 
     # NOTE: Patterns are formed from Regular Expressions.  Ruby has a
-    # very powerful Regular Expression library.  Unfortunately, time
-    # does not permit us to explore it in detail now.
+    # very powerful Regular Expression library.  We will become
+    # enlightened about them soon.
   end
 
   def test_strings_can_be_joined
     words = ["Now", "is", "the", "time"]
     assert_equal __, words.join(" ")
   end
+
+  def test_strings_are_unique_objects
+    a = "a string"
+    b = "a string"
+
+    assert_equal __, a           == b
+    assert_equal __, a.object_id == b.object_id
+  end
 end