### ----------------------------------------------------
### -- as-cli-arguments
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use as-cli-arguments;
use Test;

plan 12;

my $raku    := $*EXECUTABLE.absolute;
my $script  := $*PROGRAM.sibling("script").absolute;
my $script2 := $*PROGRAM.sibling("script-named-anywhere").absolute;

my sub test($script, @arguments, $expected) {
    is (run $raku, '-I.', $script, @arguments, :merge).out.slurp(:close).chomp,
      $expected,
      "do @arguments give $expected?";
}

test $script, <foo bar baz>,      "foo bar baz";
test $script, <--foo bar baz>,    "--foo bar baz";
test $script, <--/foo bar baz>,   "--/foo bar baz";
test $script, <--foo=bar baz>,    "--foo=bar baz";
test $script, ('--=bar', 'baz'),  "--=bar baz";
test $script, ('--=', 'baz'),     "--= baz";

test $script2, <foo bar baz>,     "foo bar baz";
test $script2, <--foo bar baz>,   "bar baz --foo";
test $script2, <--/foo bar baz>,  "bar baz --/foo";
test $script2, <--foo=bar baz>,   "baz --foo=bar";
test $script2, ('--=bar', 'baz'), "baz --=bar";
test $script2, ('--=', 'baz'),    "baz --=";

# vim: expandtab shiftwidth=4


