test: expand argument parsing sanity checks

Test the various boolean formats and --no- prefixed boolean and
keyword flag arguments.
This commit is contained in:
Jani Nikula 2017-10-14 16:16:08 +03:00 committed by David Bremner
parent e29ec5f0e9
commit ab4b033c70

View file

@ -37,4 +37,32 @@ positional arg 1 false
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "--boolean=true"
$TEST_DIRECTORY/arg-test --boolean=true > OUTPUT
cat <<EOF > EXPECTED
boolean 1
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "--boolean=false"
$TEST_DIRECTORY/arg-test --boolean=false > OUTPUT
cat <<EOF > EXPECTED
boolean 0
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "--no-boolean"
$TEST_DIRECTORY/arg-test --no-boolean > OUTPUT
cat <<EOF > EXPECTED
boolean 0
EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "--no-flag"
$TEST_DIRECTORY/arg-test --flag=one --flag=three --no-flag=three > OUTPUT
cat <<EOF > EXPECTED
flags 1
EOF
test_expect_equal_file EXPECTED OUTPUT
test_done