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