From 7ed47c1223e6b0c37a5e5e1a14e5fd31ba59bc04 Mon Sep 17 00:00:00 2001 From: Jun Hiroe Date: Fri, 11 Apr 2014 23:04:15 +0900 Subject: Array#rotate --- mrbgems/mruby-array-ext/test/array.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mrbgems/mruby-array-ext/test') 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 -- cgit v1.2.3