Created
June 29, 2010 20:01
-
-
Save tundal45/457730 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
class ArrayTest < Test::Unit::TestCase | |
def test_plus_equals_creates_new_object | |
original_string = ["Hello"] | |
hi = original_string | |
assert_equal original_string.object_id, hi.object_id | |
there = ["World"] | |
hi += there | |
assert_not_equal original_string.object_id, hi.object_id | |
end | |
def test_shovel_does_not_create_new_object | |
original_string = ["Hello"] | |
hi = original_string | |
assert_equal original_string.object_id, hi.object_id | |
there = ["World"] | |
hi << there | |
assert_equal original_string.object_id, hi.object_id | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment