2 test_description='"notmuch search" by folder: (with variations)'
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"
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"'
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)"
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)"
24 test_begin_subtest "After removing duplicate instance of matching path"
25 rm -r "${MAIL_DIR}/bad/news"
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)"
30 test_begin_subtest "After rename, old path returns nothing"
31 mv "${MAIL_DIR}/duplicate/bad/news" "${MAIL_DIR}/duplicate/bad/olds"
33 output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
34 test_expect_equal "$output" ""
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)"