]> git.notmuchmail.org Git - notmuch/commitdiff
test: expand argument parsing sanity checks
authorJani Nikula <jani@nikula.org>
Sat, 14 Oct 2017 13:16:08 +0000 (16:16 +0300)
committerDavid Bremner <david@tethera.net>
Wed, 13 Dec 2017 12:31:03 +0000 (08:31 -0400)
Test the various boolean formats and --no- prefixed boolean and
keyword flag arguments.

test/T410-argument-parsing.sh

index 71ed7e38553bcd9e1794992ecfae56e42a2ea4ec..192133c512261ce6b86b7d2ee4ad9a55b384de26 100755 (executable)
@@ -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