diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-02 16:14:12 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-02 16:14:12 -0700 |
| commit | 8583b622771fa32d0d086bfc5e3b4952bfc14be1 (patch) | |
| tree | eb80aa04df11c450928a50d9574c45ce606113df | |
| parent | 12d75223d62ed90f334980c3a15e96618250fe90 (diff) | |
| parent | 57bd8d49ec88c7f6a0432a09168af9420ae50c7e (diff) | |
| download | mruby-8583b622771fa32d0d086bfc5e3b4952bfc14be1.tar.gz mruby-8583b622771fa32d0d086bfc5e3b4952bfc14be1.zip | |
Merge pull request #233 from bovi/add-class-new-test
Add first test case for Class#new
| -rw-r--r-- | test/t/class.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/t/class.rb b/test/t/class.rb index 92f3df51d..3c398e923 100644 --- a/test/t/class.rb +++ b/test/t/class.rb @@ -5,6 +5,36 @@ assert('Class', '15.2.3') do Class.class == Class end +assert('Class#new', '15.2.3.3.3') do + # at the moment no exception on singleton class + #e1 = nil + #begin + # class1 = e1.singleton_class.new + #rescue => e1 + # e2 = e1 + #end + + class TestClass + def initialize args, &block + @result = if not args.nil? and block.nil? + # only arguments + :only_args + elsif not args.nil? and not block.nil? + # args and block is given + :args_and_block + else + # this should never happen + :broken + end + end + + def result; @result; end + end + + TestClass.new(:arg).result == :only_args + # with block doesn't work yet +end + # Not ISO specified assert('Class 1') do |
