test: basic: drop 'ensure all available tests are run'
[notmuch] / test / search-by-folder
1 #!/usr/bin/env bash
2 test_description='"notmuch search" by folder: (with variations)'
3 . ./test-lib.sh
4
5 add_message '[dir]=bad' '[subject]="To the bone"'
6 add_message '[dir]=bad/news' '[subject]="Bears"'
7 mkdir -p "${MAIL_DIR}/duplicate/bad/news"
8 cp "$gen_msg_filename" "${MAIL_DIR}/duplicate/bad/news"
9
10 add_message '[dir]=things' '[subject]="These are a few"'
11 add_message '[dir]=things/favorite' '[subject]="Raindrops, whiskers, kettles"'
12 add_message '[dir]=things/bad' '[subject]="Bites, stings, sad feelings"'
13
14 test_begin_subtest "Single-world folder: specification (multiple results)"
15 output=$(notmuch search folder:bad | notmuch_search_sanitize)
16 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; To the bone (inbox unread)
17 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)
18 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bites, stings, sad feelings (inbox unread)"
19
20 test_begin_subtest "Two-word path to narrow results to one"
21 output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
22 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)"
23
24 test_begin_subtest "After removing duplicate instance of matching path"
25 rm -r "${MAIL_DIR}/bad/news"
26 notmuch new
27 output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
28 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)"
29
30 test_begin_subtest "After rename, old path returns nothing"
31 mv "${MAIL_DIR}/duplicate/bad/news" "${MAIL_DIR}/duplicate/bad/olds"
32 notmuch new
33 output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
34 test_expect_equal "$output" ""
35
36 test_begin_subtest "After rename, new path returns result"
37 output=$(notmuch search folder:bad/olds | notmuch_search_sanitize)
38 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)"
39
40 test_done