mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
Added symbol & string identity tests.
This commit is contained in:
@@ -182,4 +182,12 @@ EOS
|
||||
words = ["Now", "is", "the", "time"]
|
||||
assert_equal __, words.join(" ")
|
||||
end
|
||||
|
||||
def test_strings_are_not_unique_objects
|
||||
a = "a string"
|
||||
b = "a string"
|
||||
|
||||
assert_equal __, a == b
|
||||
assert_equal __, a.object_id == b.object_id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,8 +19,8 @@ class AboutSymbols < EdgeCase::Koan
|
||||
symbol1 = :a_symbol
|
||||
symbol2 = :a_symbol
|
||||
|
||||
assert symbol1.equal?(__)
|
||||
assert_equal __, symbol2.object_id
|
||||
assert_equal __, symbol1 == symbol2
|
||||
assert_equal __, symbol1.object_id == symbol2.object_id
|
||||
end
|
||||
|
||||
def test_method_names_become_symbols
|
||||
|
||||
Reference in New Issue
Block a user