From 0898f40ccc46dd43cfe60c05aa19bcc13936f5a1 Mon Sep 17 00:00:00 2001 From: Jun Hiroe Date: Sat, 12 Apr 2014 01:09:00 +0900 Subject: Add Array#rotate_bang --- mrbgems/mruby-array-ext/test/array.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mrbgems/mruby-array-ext/test/array.rb') diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb index 650e49642..ab7a24df7 100644 --- a/mrbgems/mruby-array-ext/test/array.rb +++ b/mrbgems/mruby-array-ext/test/array.rb @@ -156,3 +156,13 @@ assert("Array#rotate") do assert_equal ["c", "d", "a", "b"], a.rotate(10) assert_equal [], [].rotate end + +assert("Array#rotate!") do + a = ["a", "b", "c", "d"] + assert_equal ["b", "c", "d", "a"], a.rotate! + assert_equal ["b", "c", "d", "a"], a + assert_equal ["d", "a", "b", "c"], a.rotate!(2) + assert_equal ["a", "b", "c", "d"], a.rotate!(-3) + assert_equal ["c", "d", "a", "b"], a.rotate(10) + assert_equal [], [].rotate! +end -- cgit v1.2.3