Answers now Ruby 1.9 compliant

This commit is contained in:
Jim Weirich
2010-08-16 15:05:20 -04:00
parent e8456fa321
commit 7046294343
4 changed files with 41 additions and 20 deletions

View File

@@ -141,16 +141,25 @@ EOS
def test_you_can_get_a_single_character_from_a_string
string = "Bacon, lettuce and tomato"
assert_equal __(97), string[1]
assert_equal __(97, 'a'), string[1]
# Surprised?
end
def test_single_characters_are_represented_by_integers
assert_equal __(97), ?a
assert_equal __(true), ?a == 97
in_ruby_version("1.8") do
def test_in_ruby_1_8_single_characters_are_represented_by_integers
assert_equal __(97, 'a'), ?a
assert_equal __(true, false), ?a == 97
assert_equal __(true), ?b == (?a + 1)
assert_equal __(true), ?b == (?a + 1)
end
end
in_ruby_version("1.9") do
def test_in_ruby_1_8_single_characters_are_represented_by_strings
assert_equal __('a'), ?a
assert_equal __(false), ?a == 97
end
end
def test_strings_can_be_split