unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 63ed57b9a18a157c995ec2f2a5263ef783456444 2156 bytes (raw)
name: test/search-by-folder 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
#!/bin/bash
test_description='"notmuch search" by folder: (with variations)'
. ./test-lib.sh

add_message '[dir]=bad' '[subject]="To the bone"'
add_message '[dir]=bad/news' '[subject]="Bears"'
mkdir -p "${MAIL_DIR}/duplicate/bad/news"
cp "$gen_msg_filename" "${MAIL_DIR}/duplicate/bad/news"

add_message '[dir]=things' '[subject]="These are a few"'
add_message '[dir]=things/favorite' '[subject]="Raindrops, whiskers, kettles"'
add_message '[dir]=things/bad' '[subject]="Bites, stings, sad feelings"'

test_begin_subtest "Single-world folder: specification (multiple results)"
output=$(notmuch search folder:bad | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; To the bone (inbox unread)
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bites, stings, sad feelings (inbox unread)"

test_begin_subtest "Two-word path to narrow results to one"
output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)"

test_begin_subtest "After removing duplicate instance of matching path"
rm -r "${MAIL_DIR}/bad/news"
increment_mtime "${MAIL_DIR}/bad"
notmuch new
output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)"

test_begin_subtest "After rename, old multi-word path returns nothing"
mv "${MAIL_DIR}/duplicate/bad/news" "${MAIL_DIR}/duplicate/bad/olds"
increment_mtime "${MAIL_DIR}/duplicate/bad"
notmuch new
output=$(notmuch search folder:bad/news | notmuch_search_sanitize)
test_expect_equal "$output" ""

test_begin_subtest "After rename, old single-word path returns nothing"
output=$(notmuch search folder:news | notmuch_search_sanitize)
test_expect_equal "$output" ""

test_begin_subtest "After rename, new path returns result"
output=$(notmuch search folder:bad/olds | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)"

test_done

debug log:

solving 63ed57b ...
found 63ed57b in https://yhetil.org/notmuch/877hc3x5td.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me/
found 162158c in https://yhetil.org/notmuch.git/
preparing index
index prepared:
100755 162158c385a6e1c66af1699ce4d1133e375ce56f	test/search-by-folder

applying [1/1] https://yhetil.org/notmuch/877hc3x5td.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me/
diff --git a/test/search-by-folder b/test/search-by-folder
index 162158c..63ed57b 100755

Checking patch test/search-by-folder...
Applied patch test/search-by-folder cleanly.

index at:
100755 63ed57b9a18a157c995ec2f2a5263ef783456444	test/search-by-folder

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).