### ----------------------------------------------------
### -- P5shift
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use v6.*;
use Test;
use P5shift;

plan 14;

ok defined(::('&shift')),           'is &shift imported?';
ok defined(::('&unshift')),         'is &unshift imported?';

my @a = 1;
is (unshift @a, 42), 2, 'does unshift return number of elems';
is @a, "42 1", 'did it actually unshift';
is (unshift @a, 666,667), 4, 'does unshift return number of elems';
is-deeply @a, [666,667,42,1], 'did it actually unshift';

is (shift @a), 666, 'does first specific shift also work';
is (shift @a), 667, 'does second specific shift also work';
is (shift @a),  42, 'does third specific shift also work';
is (shift @a),   1, 'does fourth specific shift also work';
is (shift @a), Nil, 'does fifth specific shift also work';

@*ARGS = <FOO BAR>;
is shift, "FOO", 'does bare shift shift from @*ARGS at top level (1)';
is shift, "BAR", 'does bare shift shift from @*ARGS at top level (2)';
is shift, Nil, 'does bare shift shift from @*ARGS at top level (3)';

# vim: expandtab shiftwidth=4


