Skip to content

Instantly share code, notes, and snippets.

@aarongough
Created May 20, 2010 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarongough/407162 to your computer and use it in GitHub Desktop.
Save aarongough/407162 to your computer and use it in GitHub Desktop.
require 'test/unit'
class FinallySaneTest < Test::Unit::TestCase
def test_deep_copy
complex_array = [{:blah => "hello"},{:foo => "blah"}]
copied_array = Marshal.load(Marshal.dump(complex_array))
copied_array[0][:blah] = nil
assert_not_equal copied_array, complex_array
end
end
# 1 tests, 1 assertions, 0 failures, 0 errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment