diff options
author | Urban Müller | 2023-08-03 17:55:27 +0200 |
---|---|---|
committer | Urban Müller | 2023-08-03 17:55:27 +0200 |
commit | 6c41ded544558d01e87d20000360c682a88303b1 (patch) | |
tree | 135f4d23bac5884b667a36fdacdd4538fbe5d77d /test | |
parent | c7da6f7683cac617afc201b48b0b1c4268b38d05 (diff) | |
download | itools-6c41ded544558d01e87d20000360c682a88303b1.tar.gz itools-6c41ded544558d01e87d20000360c682a88303b1.tar.bz2 itools-6c41ded544558d01e87d20000360c682a88303b1.zip |
allow echoing and dry-running of it::exec/it::system commands
Diffstat (limited to 'test')
-rwxr-xr-x | test/exec.t | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/exec.t b/test/exec.t index 5f3ebb5..9e55726 100755 --- a/test/exec.t +++ b/test/exec.t @@ -4,14 +4,16 @@ # Tests for getopt in it.class is(it::exec("echo gna"), "gna\n", "basic exec"); -is(it::exec("echo {arg}", ['arg' => 'gna']), "gna\n", "exec with argument"); +is(it::exec("echo {arg}", ['arg' => 'gnu'], ['arg' => "gna"]), "gna\n", "exec with argument"); is(it::exec("echo {0}", 'gna'), "gna\n", "exec with positional argument"); -is(it::shell_command("echo {arg}", ['arg' => 'gna07,-:blah']), "echo gna07,-:blah", "don't quote arguments with only whitelistes characters"); -is(it::shell_command("echo {arg}", ['arg' => '2>&1']), "echo '2>&1'", "quote arguments with dangerous characters"); -is(it::shell_command("echo {arg}", ['arg' => '']), "echo ''", "quote empty arguments"); -is(it::shell_command("echo {arg}", ['arg' => null]), "echo ", "remove null values"); -is(it::shell_command("echo {arg}", ['arg' => false]), "echo ", "remove false values"); -is(it::shell_command("echo {arg}", ['arg' => []]), "echo ", "remove empty arrays"); +is(it::shell_command("echo {arg}", ['arg' => 'gna07,-:blah']), "echo gna07,-:blah", "don't quote arguments with only whitelistes characters"); +is(it::shell_command("echo {arg}", ['arg' => '2>&1']), "echo '2>&1'", "quote arguments with dangerous characters"); +is(it::shell_command("echo {arg}", ['arg' => '']), "echo ''", "quote empty arguments"); +is(it::shell_command("echo {arg}", ['arg' => null]), "echo ", "remove null values"); +is(it::shell_command("echo {arg}", ['arg' => false]), "echo ", "remove false values"); +is(it::shell_command("echo {arg}", ['arg' => []]), "echo ", "remove empty arrays"); +is(it::shell_command("echo {arg}", (object)['arg' => "foo"]) , "echo foo", "allow objects"); +is(it::shell_command("echo {arg}", ['arg' => 1], ['arg' => 2]), "echo 2", "support varargs"); is( |