PageRenderTime 50ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/gems/facets-2.4.5/test/more/test_cloneable.rb

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 41 lines | 35 code | 6 blank | 0 comment | 0 complexity | 204365375d5c62883769db75ff417e85 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
  1. require 'facets/cloneable'
  2. require 'test/unit'
  3. class Foo
  4. include Cloneable
  5. def initialize
  6. @bar=[]
  7. end
  8. def bar_id
  9. @bar.object_id
  10. end
  11. end
  12. class TestCloneable < Test::Unit::TestCase
  13. def test_dup
  14. a=Foo.new
  15. b=a.dup
  16. assert_not_equal a.bar_id,b.bar_id
  17. a.taint
  18. b=a.dup
  19. assert b.tainted?, "b should be tainted"
  20. a.freeze
  21. b=a.dup
  22. assert !b.frozen?, "b should not be frozen"
  23. end
  24. def test_clone
  25. a=Foo.new
  26. b=a.clone
  27. assert_not_equal a.bar_id,b.bar_id
  28. a.taint
  29. b=a.dup
  30. assert b.tainted?, "b should be tainted"
  31. a.freeze
  32. b=a.clone
  33. assert b.frozen?, "b should be frozen"
  34. end
  35. end