]> git.notmuchmail.org Git - notmuch/blob - test/T690-command-line-args.sh
test: use $(dirname "$0") for sourcing test-lib.sh
[notmuch] / test / T690-command-line-args.sh
1 #!/usr/bin/env bash
2
3 test_description="command line arguments"
4 . $(dirname "$0")/test-lib.sh || exit 1
5
6 add_message
7
8 test_begin_subtest 'bad option to show'
9 notmuch show --frobnicate >& OUTPUT
10 cat <<EOF > EXPECTED
11 Unrecognized option: --frobnicate
12 EOF
13 test_expect_equal_file EXPECTED OUTPUT
14
15 test_begin_subtest 'string option with space'
16 cp /dev/null EXPECTED
17 notmuch dump --output foo.txt '*' >& OUTPUT
18 test_expect_equal_file EXPECTED OUTPUT
19
20 test_begin_subtest 'string option with ='
21 cp /dev/null EXPECTED
22 notmuch dump --output=foo.txt '*' >& OUTPUT
23 test_expect_equal_file EXPECTED OUTPUT
24
25 test_begin_subtest 'string option with :'
26 cp /dev/null EXPECTED
27 notmuch dump --output:foo.txt '*' >& OUTPUT
28 test_expect_equal_file EXPECTED OUTPUT
29
30 test_begin_subtest 'single keyword option with space'
31 cat <<EOF > EXPECTED
32 id:msg-001@notmuch-test-suite
33 EOF
34 notmuch search --output messages '*' >& OUTPUT
35 test_expect_equal_file EXPECTED OUTPUT
36
37 test_begin_subtest 'single keyword option with ='
38 cat <<EOF > EXPECTED
39 id:msg-001@notmuch-test-suite
40 EOF
41 notmuch search --output=messages '*' >& OUTPUT
42 test_expect_equal_file EXPECTED OUTPUT
43
44 test_begin_subtest 'single keyword option with :'
45 cat <<EOF > EXPECTED
46 id:msg-001@notmuch-test-suite
47 EOF
48 notmuch search --output:messages '*' >& OUTPUT
49 test_expect_equal_file EXPECTED OUTPUT
50
51 test_begin_subtest 'multiple keyword options with space'
52 cat <<EOF > EXPECTED
53 ["msg-001@notmuch-test-suite"]
54 EOF
55 notmuch search --output messages --format json '*' >& OUTPUT
56 test_expect_equal_file EXPECTED OUTPUT
57
58 test_begin_subtest 'multiple keyword options with ='
59 cat <<EOF > EXPECTED
60 ["msg-001@notmuch-test-suite"]
61 EOF
62 notmuch search --output=messages --format=json '*' >& OUTPUT
63 test_expect_equal_file EXPECTED OUTPUT
64
65 test_begin_subtest 'mixed space and = delimiters'
66 cat <<EOF > EXPECTED
67 ["msg-001@notmuch-test-suite"]
68 EOF
69 notmuch search --output messages --format=json '*' >& OUTPUT
70 test_expect_equal_file EXPECTED OUTPUT
71
72 test_begin_subtest 'mixed space and : delimiters'
73 cat <<EOF > EXPECTED
74 ["msg-001@notmuch-test-suite"]
75 EOF
76 notmuch search --output:messages --format json '*' >& OUTPUT
77 test_expect_equal_file EXPECTED OUTPUT
78
79 test_begin_subtest 'show --entire-thread'
80 test_expect_success 'notmuch show --entire-thread tag:test > /dev/null'
81
82 test_begin_subtest 'show --exclude'
83 test_expect_success 'notmuch show --exclude tag:test > /dev/null'
84
85 test_done