Skip to content

Commit

Permalink
Fixed test_you_can_get_a_single_character_from_a_string for multiple …
Browse files Browse the repository at this point in the history
…rubies (1.8, 1.9)
  • Loading branch information
TheSeparateFirst committed Mar 12, 2011
1 parent 3fd8d9d commit a46642e
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions koans/about_strings.rb
Expand Up @@ -139,13 +139,6 @@ def test_you_can_get_a_substring_from_a_string
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
Expand All @@ -162,6 +155,26 @@ def test_in_ruby_1_9_single_characters_are_represented_by_strings
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 "a", string[1]

# Surprised?
end
end


def test_strings_can_be_split
string = "Sausage Egg Cheese"
words = string.split
Expand Down

0 comments on commit a46642e

Please sign in to comment.