Created
September 6, 2017 07:59
-
-
Save niner/a75aebd0e91af200df21b233d82aa5af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6.c; | |
use Test; | |
use Native::Command; | |
sub true() is command { * } | |
sub ls($dir?, :$l, :$help) is command { * } | |
is(true().run.exitcode, 0); | |
# long switches :help -> --help | |
is(ls(:help).run(:out).exitcode, 0); | |
like(ls(:help).run(:out).out.lines[0], /Usage/); | |
# positionals will follow switches | |
is(ls('lib').run(:out).out.lines[0], 'Native'); | |
# shortcut for a very common case, same as above | |
is(ls('lib').out.lines[0], 'Native'); | |
# short switch (just 1 character) :l -> -l | |
like(ls('lib', :l).run(:out).out.lines[0], /total/); | |
done-testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment