summaryrefslogtreecommitdiffhomepage
path: root/test/t
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-17 00:16:01 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-17 00:16:01 +0900
commit3687e1f97b8a3fd058791d30f5d6f58285a627c6 (patch)
tree95c83ace18e45d610145fa200406b1369a5fbe97 /test/t
parent55c1942b43b1e62956e6ce1798dc10fe742d617c (diff)
parent0d82ada9229cb01279e087246fcd1bcb4d5ddd29 (diff)
downloadmruby-3687e1f97b8a3fd058791d30f5d6f58285a627c6.tar.gz
mruby-3687e1f97b8a3fd058791d30f5d6f58285a627c6.zip
Merge branch 'master' of github.com:mruby/mruby
Diffstat (limited to 'test/t')
-rw-r--r--test/t/enumerable.rb32
-rw-r--r--test/t/float.rb3
-rw-r--r--test/t/integer.rb6
3 files changed, 41 insertions, 0 deletions
diff --git a/test/t/enumerable.rb b/test/t/enumerable.rb
index ed062823c..844251b06 100644
--- a/test/t/enumerable.rb
+++ b/test/t/enumerable.rb
@@ -8,11 +8,43 @@ end
assert('Enumerable#all?', '15.3.2.2.1') do
assert_true([1,2,3].all?)
assert_false([1,false,3].all?)
+
+ a = [2,4,6]
+ all = a.all? do |e|
+ if e % 2 == 0
+ true
+ end
+ end
+ assert_true(all)
+
+ a = [2,4,7]
+ all = a.all? do |e|
+ if e % 2 == 0
+ true
+ end
+ end
+ assert_false(all)
end
assert('Enumerable#any?', '15.3.2.2.2') do
assert_true([false,true,false].any?)
assert_false([false,false,false].any?)
+
+ a = [1,3,6]
+ any = a.any? do |e|
+ if e % 2 == 0
+ true
+ end
+ end
+ assert_true(any)
+
+ a = [1,3,5]
+ any = a.any? do |e|
+ if e % 2 == 0
+ true
+ end
+ end
+ assert_false(any)
end
assert('Enumerable#collect', '15.3.2.2.3') do
diff --git a/test/t/float.rb b/test/t/float.rb
index b50b1e175..c817e01da 100644
--- a/test/t/float.rb
+++ b/test/t/float.rb
@@ -15,6 +15,9 @@ assert('Float#+', '15.2.9.3.1') do
assert_float(3.123456789, a)
assert_float(4.123456789, b)
+
+ assert_raise(TypeError){ 0.0+nil }
+ assert_raise(TypeError){ 1.0+nil }
end
assert('Float#-', '15.2.9.3.2') do
diff --git a/test/t/integer.rb b/test/t/integer.rb
index 2bffce5a9..66dd61c0b 100644
--- a/test/t/integer.rb
+++ b/test/t/integer.rb
@@ -15,6 +15,9 @@ assert('Integer#+', '15.2.8.3.1') do
assert_equal 2, a
assert_equal 2.0, b
+
+ assert_raise(TypeError){ 0+nil }
+ assert_raise(TypeError){ 1+nil }
end
assert('Integer#-', '15.2.8.3.2') do
@@ -31,6 +34,9 @@ assert('Integer#*', '15.2.8.3.3') do
assert_equal 1, a
assert_equal 1.0, b
+
+ assert_raise(TypeError){ 0*nil }
+ assert_raise(TypeError){ 1*nil }
end
assert('Integer#/', '15.2.8.3.4') do