summaryrefslogtreecommitdiff
path: root/tests/modules/os/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-10 23:27:43 +0800
committerruki <[email protected]>2021-01-10 23:27:43 +0800
commite2b269b725607e0458cc337555e64c9c7fecde9f (patch)
tree28c7a307fe23bd693c0099d1c47100dc5767cc1a /tests/modules/os/test.lua
parentce87d03e8ea89130933b2bc1b52e8bc31257fcfd (diff)
improve tests again
Diffstat (limited to 'tests/modules/os/test.lua')
-rw-r--r--tests/modules/os/test.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/modules/os/test.lua b/tests/modules/os/test.lua
index cf55366e8..e5e27456b 100644
--- a/tests/modules/os/test.lua
+++ b/tests/modules/os/test.lua
@@ -79,8 +79,14 @@ function test_argv(t)
t:are_equal(os.argv('"aa\\\\bb/cc (dd)" ee'), {"aa\\bb/cc (dd)", "ee"})
-- $cli -DTEST=\"hello\"
t:are_equal(os.argv('-DTEST=\\"hello\\"'), {'-DTEST="hello"'})
+ -- $cli -DTEST=\"hello\" -DTEST=\"hello\"
+ t:are_equal(os.argv('-DTEST=\\"hello\\" -DTEST2=\\"hello\\"'), {'-DTEST="hello"', '-DTEST2="hello"'})
-- $cli -DTEST="hello"
t:are_equal(os.argv('-DTEST="hello"'), {'-DTEST=hello'})
+ -- $cli -DTEST="hello world"
+ t:are_equal(os.argv('-DTEST="hello world"'), {'-DTEST=hello world'})
+ -- $cli -DTEST=\"hello world\"
+ t:are_equal(os.argv('-DTEST=\\"hello world\\"'), {'-DTEST="hello', 'world\"'})
-- $cli "-DTEST=\"hello world\"" "-DTEST2="\hello world2\""
t:are_equal(os.argv('"-DTEST=\\\"hello world\\\"" "-DTEST2=\\\"hello world2\\\""'), {'-DTEST="hello world"', '-DTEST2="hello world2"'})
-- $cli '-DTEST="hello world"' '-DTEST2="hello world2"'
@@ -98,6 +104,7 @@ function test_args(t)
t:are_equal(os.args({"aa\\bb/cc (dd)", "ee"}), '"aa\\\\bb/cc (dd)" ee')
t:are_equal(os.args({"aa\\bb/cc", "dd"}, {escape = true}), "aa\\\\bb/cc dd")
t:are_equal(os.args('-DTEST="hello"'), '-DTEST=\\"hello\\"')
+ t:are_equal(os.args({'-DTEST="hello"', '-DTEST2="hello"'}), '-DTEST=\\"hello\\" -DTEST2=\\"hello\\"')
t:are_equal(os.args('-DTEST=hello'), '-DTEST=hello') -- irreversible
-- t:are_equal(os.args({'-DTEST="hello world"', '-DTEST2="hello world2"'}), '"-DTEST=\\\"hello world\\\"" "-DTEST2=\\\"hello world2\\\""')
end