diff options
| author | Masaki Muranaka <[email protected]> | 2013-04-06 18:22:42 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2013-04-06 18:22:42 +0900 |
| commit | d1b131e2b085e180fd6f59dd8016cd06361f93b2 (patch) | |
| tree | bbc1e9cf56e5bc2c0a6fd77045e0dfeb43881255 /test/t/kernel.rb | |
| parent | e885e59d4537f164b600d2fc579cc195cc8df76f (diff) | |
| download | mruby-d1b131e2b085e180fd6f59dd8016cd06361f93b2.tar.gz mruby-d1b131e2b085e180fd6f59dd8016cd06361f93b2.zip | |
Add some tests.
Diffstat (limited to 'test/t/kernel.rb')
| -rw-r--r-- | test/t/kernel.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/t/kernel.rb b/test/t/kernel.rb index 835834359..40f73250b 100644 --- a/test/t/kernel.rb +++ b/test/t/kernel.rb @@ -155,6 +155,16 @@ assert('Kernel#clone', '15.3.1.3.8') do a.set(2) c = a.clone + immutables = [ 1, :foo, true, false, nil ] + error_count = 0 + immutables.each do |i| + begin + i.clone + rescue TypeError + error_count += 1 + end + end + a.get == 2 and b.get == 1 and c.get == 2 && a.respond_to?(:test) == true and b.respond_to?(:test) == false and @@ -185,7 +195,18 @@ assert('Kernel#dup', '15.3.1.3.9') do a.set(2) c = a.dup - a.get == 2 and b.get == 1 and c.get == 2 and + immutables = [ 1, :foo, true, false, nil ] + error_count = 0 + immutables.each do |i| + begin + i.dup + rescue TypeError + error_count += 1 + end + end + + error_count == immutables.size and + a.get == 2 and b.get == 1 and c.get == 2 and a.respond_to?(:test) == true and b.respond_to?(:test) == false and c.respond_to?(:test) == false |
