unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 3bbe47cff41f71a270267160fe1433ca72893007 4439 bytes (raw)
name: test/T630-regexp-query.sh 	 # 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 
#!/usr/bin/env bash
test_description='regular expression searches'
. ./test-lib.sh || exit 1

add_email_corpus


if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 1 ]; then

    notmuch search --output=messages from:cworth > cworth.msg-ids

    test_begin_subtest "regexp from search, case sensitive"
    notmuch search --output=messages re:from:carl > OUTPUT
    test_expect_equal_file /dev/null OUTPUT

    test_begin_subtest "empty regexp or query"
    notmuch search --output=messages re:from:carl or from:cworth > OUTPUT
    test_expect_equal_file cworth.msg-ids OUTPUT

    test_begin_subtest "non-empty regexp and query"
    notmuch search  re:from:cworth and subject:patch > OUTPUT
    cat <<EOF > EXPECTED
thread:0000000000000008   2009-11-18 [1/2] Carl Worth| Alex Botero-Lowry; [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
thread:0000000000000007   2009-11-18 [1/2] Carl Worth| Ingmar Vanhassel; [notmuch] [PATCH] Typsos (inbox unread)
thread:0000000000000018   2009-11-18 [1/2] Carl Worth| Jan Janak; [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
thread:0000000000000017   2009-11-18 [1/2] Carl Worth| Keith Packard; [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
thread:0000000000000014   2009-11-18 [2/5] Carl Worth| Mikhail Gusarov, Keith Packard; [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
thread:0000000000000001   2009-11-18 [1/1] Stewart Smith; [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (inbox unread)
EOF
    test_expect_equal_file EXPECTED OUTPUT

    test_begin_subtest "regexp from search, duplicate term search"
    notmuch search --output=messages re:from:cworth > OUTPUT
    test_expect_equal_file cworth.msg-ids OUTPUT

    test_begin_subtest "long enough regexp matches only desired senders"
    notmuch search --output=messages 're:"from:C.* Wo"' > OUTPUT
    test_expect_equal_file cworth.msg-ids OUTPUT

    test_begin_subtest "shorter regexp matches one more sender"
    notmuch search --output=messages 're:"from:C.* W"' > OUTPUT
    (echo id:1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk ; cat cworth.msg-ids) > EXPECTED
    test_expect_equal_file EXPECTED OUTPUT

    test_begin_subtest "regexp subject search, non-ASCII"
    notmuch search --output=messages re:subject:accentué > OUTPUT
    echo id:877h1wv7mg.fsf@inf-8657.int-evry.fr > EXPECTED
    test_expect_equal_file EXPECTED OUTPUT

    test_begin_subtest "regexp subject search, punctuation"
    notmuch search   re:subject:\'X\' > OUTPUT
    cat <<EOF > EXPECTED
thread:0000000000000017   2009-11-18 [2/2] Keith Packard, Carl Worth; [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
EOF
    test_expect_equal_file EXPECTED OUTPUT

    test_begin_subtest "regexp subject search, no punctuation"
    notmuch search  re:subject:X > OUTPUT
    cat <<EOF > EXPECTED
thread:0000000000000017   2009-11-18 [2/2] Keith Packard, Carl Worth; [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
thread:000000000000000f   2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
EOF
    test_expect_equal_file EXPECTED OUTPUT

    test_begin_subtest "combine regexp from and subject"
    notmuch search  re:subject:-C and re:from:.an.k > OUTPUT
    cat <<EOF > EXPECTED
thread:0000000000000018   2009-11-17 [1/2] Jan Janak| Carl Worth; [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
EOF
    test_expect_equal_file EXPECTED OUTPUT

    test_begin_subtest "bad subprefix"
    notmuch search 're:unsupported:.*' 1>OUTPUT 2>&1
    cat <<EOF > EXPECTED
notmuch search: A Xapian exception occurred
A Xapian exception occurred performing query: unsupported regexp field 'unsupported'
Query string was: re:unsupported:.*
EOF
    test_expect_equal_file EXPECTED OUTPUT

    test_begin_subtest "regexp error reporting"
    notmuch search 're:from:unbalanced[' 1>OUTPUT 2>&1
    cat <<EOF > EXPECTED
notmuch search: A Xapian exception occurred
A Xapian exception occurred performing query: Invalid regular expression
Query string was: re:from:unbalanced[
EOF
    test_expect_equal_file EXPECTED OUTPUT
fi

test_done

debug log:

solving 3bbe47cf ...
retrying 3bbe47cf as 3bbe47c
found 3bbe47c in https://yhetil.org/notmuch/20161114214651.19770-1-david@tethera.net/ ||
	https://yhetil.org/notmuch/1467034387-16885-1-git-send-email-david@tethera.net/

applying [1/1] https://yhetil.org/notmuch/20161114214651.19770-1-david@tethera.net/
diff --git a/test/T630-regexp-query.sh b/test/T630-regexp-query.sh
new file mode 100755
index 0000000..3bbe47c

Checking patch test/T630-regexp-query.sh...
Applied patch test/T630-regexp-query.sh cleanly.

skipping https://yhetil.org/notmuch/1467034387-16885-1-git-send-email-david@tethera.net/ for 3bbe47c
index at:
100755 3bbe47cff41f71a270267160fe1433ca72893007	test/T630-regexp-query.sh

(*) 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).