Skip to content

Instantly share code, notes, and snippets.

@daxim
Created November 23, 2011 16:26
Show Gist options
  • Save daxim/1389127 to your computer and use it in GitHub Desktop.
Save daxim/1389127 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use perl5i::latest;
use lib 't/lib';
use Test::More;
use Test::perl5i;
is_deeply(
scalar [ 'foo', 'bar', 'baz' ]->rotate,
[ 'fbb', 'oaa', 'orz' ],
'Right array rotate'
);
is_deeply(
scalar [qw(AAA BBB 123)]->rotate,
[qw(AB1 AB2 AB3)]
);
is_deeply(
scalar [qw(A BBB 1234)]->rotate,
["AB1", " B2", " B3", " 4"]
);
is_deeply(
scalar [qw(AAA23 AB1D1 A1BC AAB212)]->rotate,
["AAAA", "AB1A", "A1BB", "2DC2", "31 1", " 2",]
);
is_deeply(
scalar ['AB C']->rotate->rotate,
['AB C'],
'rotated twice is identical'
);
is_deeply(
scalar []->rotate,
[],
);
is_deeply(
scalar ['']->rotate,
[''],
);
is_deeply(
scalar ['A']->rotate,
['A'],
);
is_deeply(
scalar ['00']->rotate,
['0', '0'],
);
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment