ruby-changes:25048
From: tenderlove <ko1@a...>
Date: Sat, 6 Oct 2012 01:22:13 +0900 (JST)
Subject: [ruby-changes:25048] tenderlove:r37100 (trunk): Adding a test for initialize_clone and initialize_dup. From Github:
tenderlove 2012-10-06 01:22:03 +0900 (Sat, 06 Oct 2012) New Revision: 37100 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37100 Log: Adding a test for initialize_clone and initialize_dup. From Github: https://github.com/ruby/ruby/pull/190 Modified files: trunk/test/ruby/test_object.rb Index: test/ruby/test_object.rb =================================================================== --- test/ruby/test_object.rb (revision 37099) +++ test/ruby/test_object.rb (revision 37100) @@ -21,6 +21,17 @@ end end + def test_init_dupclone + cls = Class.new do + def initialize_clone(orig); throw :initialize_clone; end + def initialize_dup(orig); throw :initialize_dup; end + end + + obj = cls.new + assert_throws(:initialize_clone) {obj.clone} + assert_throws(:initialize_dup) {obj.dup} + end + def test_instance_of assert_raise(TypeError) { 1.instance_of?(1) } end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/