summaryrefslogtreecommitdiffhomepage
path: root/test/t/class.rb
diff options
context:
space:
mode:
authorMasaki Muranaka <[email protected]>2013-04-02 11:37:58 +0900
committerMasaki Muranaka <[email protected]>2013-04-02 11:43:30 +0900
commite129a4c8ef5b9bffc696202a73575c8ead187175 (patch)
tree62334a1a44281219d40f478ef929de9bdade2709 /test/t/class.rb
parent6bd49a3d95c836e82382f333a600a368bf0638fc (diff)
downloadmruby-e129a4c8ef5b9bffc696202a73575c8ead187175.tar.gz
mruby-e129a4c8ef5b9bffc696202a73575c8ead187175.zip
Add test cases.
Diffstat (limited to 'test/t/class.rb')
-rw-r--r--test/t/class.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/t/class.rb b/test/t/class.rb
index 1c50853dc..72214a2fc 100644
--- a/test/t/class.rb
+++ b/test/t/class.rb
@@ -9,6 +9,26 @@ assert('Class superclass', '15.2.3.2') do
Class.superclass == Module
end
+# Class#initialize '15.2.3.3.1' is tested in Class#new
+
+assert('Class#initialize_copy', '15.2.3.3.2') do
+ class TestClass
+ attr_accessor :n
+ def initialize(n)
+ @n = n
+ end
+ def initialize_copy(obj)
+ @n = n
+ end
+ end
+
+ c1 = TestClass.new('Foo')
+ c2 = c1.dup
+ c3 = TestClass.new('Bar')
+
+ c1.n == c2.n and c1.n != c3.n
+end
+
assert('Class#new', '15.2.3.3.3') do
# at the moment no exception on singleton class
#e1 = nil