summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-04-11 23:45:52 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-11 23:45:52 +0900
commitfe55b9dd1cca607398454bd2d432b2482f40cbef (patch)
tree603686c977831c1b60932eaad6ffd4dd9dcd07cb /mrbgems/mruby-array-ext/test
parent92156b46194591ea7608ee9c587c6e29cacd25ea (diff)
parent7ed47c1223e6b0c37a5e5e1a14e5fd31ba59bc04 (diff)
downloadmruby-fe55b9dd1cca607398454bd2d432b2482f40cbef.tar.gz
mruby-fe55b9dd1cca607398454bd2d432b2482f40cbef.zip
Merge pull request #2045 from suzukaze/add-array.rotate
Array#rotate
Diffstat (limited to 'mrbgems/mruby-array-ext/test')
-rw-r--r--mrbgems/mruby-array-ext/test/array.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb
index 8c6a7bd54..650e49642 100644
--- a/mrbgems/mruby-array-ext/test/array.rb
+++ b/mrbgems/mruby-array-ext/test/array.rb
@@ -146,3 +146,13 @@ assert("Array#reverse_each") do
true
end
end
+
+assert("Array#rotate") do
+ a = ["a", "b", "c", "d"]
+ assert_equal ["b", "c", "d", "a"], a.rotate
+ assert_equal ["a", "b", "c", "d"], a
+ assert_equal ["c", "d", "a", "b"], a.rotate(2)
+ assert_equal ["b", "c", "d", "a"], a.rotate(-3)
+ assert_equal ["c", "d", "a", "b"], a.rotate(10)
+ assert_equal [], [].rotate
+end