[PATCH 9/9] test: expand argument parsing sanity checks
Jani Nikula
jani at nikula.org
Tue Sep 19 13:39:29 PDT 2017
Test the various boolean formats, --no- prefixed boolean and keyword
flag arguments, and space between option and option argument.
---
test/T410-argument-parsing.sh | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/test/T410-argument-parsing.sh b/test/T410-argument-parsing.sh
index 4505c58301ea..f3094e1e741a 100755
--- a/test/T410-argument-parsing.sh
+++ b/test/T410-argument-parsing.sh
@@ -15,4 +15,41 @@ positional arg 2 pos2
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
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "--no-boolean"
+$TEST_DIRECTORY/arg-test --no-boolean > OUTPUT
+cat <<EOF > EXPECTED
+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_begin_subtest "--param SPC arg"
+$TEST_DIRECTORY/arg-test --keyword two --no-boolean --string foo pos2 --int 7 --flag one --flag three > OUTPUT
+cat <<EOF > EXPECTED
+keyword 2
+flags 5
+int 7
+string foo
+positional arg 1 pos2
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
test_done
--
2.11.0
More information about the notmuch
mailing list