summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-04-17 17:38:44 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-04-17 17:38:44 +0900
commit737254588b272ea898ebddd9fc4307fa555ddc35 (patch)
tree539505549d74f97586660e76b7300a47776e18f9 /mrbgems/mruby-array-ext/test
parent9d32d440ebf1ebd0684f5349316a15602bea5421 (diff)
downloadmruby-737254588b272ea898ebddd9fc4307fa555ddc35.tar.gz
mruby-737254588b272ea898ebddd9fc4307fa555ddc35.zip
array.rb: add `Array#intersect?` from Ruby3.0.1.
Diffstat (limited to 'mrbgems/mruby-array-ext/test')
-rw-r--r--mrbgems/mruby-array-ext/test/array.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb
index 2955ef391..3f73ad8b9 100644
--- a/mrbgems/mruby-array-ext/test/array.rb
+++ b/mrbgems/mruby-array-ext/test/array.rb
@@ -119,6 +119,14 @@ assert("Array#intersection") do
assert_equal [1, 8], a.intersection(b,c)
end
+assert("Array#intersect?") do
+ a = [ 1, 2, 3 ]
+ b = [ 3, 4, 5 ]
+ c = [ 5, 6, 7 ]
+ assert_true(a.intersect?(b))
+ assert_false(a.intersect?(c))
+end
+
assert("Array#flatten") do
assert_equal [1, 2, "3", {4=>5}, :'6'], [1, 2, "3", {4=>5}, :'6'].flatten
assert_equal [1, 2, 3, 4, 5, 6], [1, 2, [3, 4, 5], 6].flatten