diff options
| author | Daniel Bovensiepen <[email protected]> | 2012-05-25 14:01:14 +0800 |
|---|---|---|
| committer | Daniel Bovensiepen <[email protected]> | 2012-05-25 14:01:14 +0800 |
| commit | 150b235fb650f15277e99080bc639bc4b60e08ba (patch) | |
| tree | 12f76d18a191c41d2e9f6098e673a6d080032cde /test/t/proc.rb | |
| parent | d9227aa41d8e626e7ff706f2d8cb94fea08658a9 (diff) | |
| download | mruby-150b235fb650f15277e99080bc639bc4b60e08ba.tar.gz mruby-150b235fb650f15277e99080bc639bc4b60e08ba.zip | |
Add Tests for all Exception classes, for false, true, Proc, Module, nil and Object
Diffstat (limited to 'test/t/proc.rb')
| -rw-r--r-- | test/t/proc.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/t/proc.rb b/test/t/proc.rb new file mode 100644 index 000000000..68d8ca8f6 --- /dev/null +++ b/test/t/proc.rb @@ -0,0 +1,45 @@ +## +# Proc ISO Test + +assert('Proc', '15.2.17') do + Proc.class == Class +end + +assert('Proc.new', '15.2.17.3.1') do + a = nil + + begin + Proc.new + rescue => e + a = e + end + + b = Proc.new {} + + a.class == ArgumentError and b.class == Proc +end + +assert('Proc#[]', '15.2.17.4.1') do + a = 0 + b = Proc.new { a += 1 } + b.[] + + a2 = 0 + b2 = Proc.new { |i| a2 += i } + b2.[](5) + + a == 1 and a2 == 5 +end + +assert('Proc#call', '15.2.17.4.3') do + a = 0 + b = Proc.new { a += 1 } + b.call + + a2 = 0 + b2 = Proc.new { |i| a2 += i } + b2.call(5) + + a == 1 and a2 == 5 +end + |
