]> git.cworth.org Git - notmuch/blob - test/T710-message-id.sh
perf-test/T00-new: fix backup creation.
[notmuch] / test / T710-message-id.sh
1 #!/usr/bin/env bash
2 test_description="message id parsing"
3
4 . $(dirname "$0")/test-lib.sh || exit 1
5
6 test_begin_subtest "good message ids"
7 ${TEST_DIRECTORY}/message-id-parse <<EOF >OUTPUT
8 <018b1a8f2d1df62e804ce88b65401304832dfbbf.1346614915.git.jani@nikula.org>
9 <1530507300.raoomurnbf.astroid@strange.none>
10 <1258787708-21121-2-git-send-email-keithp@keithp.com>
11 EOF
12 cat <<EOF >EXPECTED
13 GOOD: 018b1a8f2d1df62e804ce88b65401304832dfbbf.1346614915.git.jani@nikula.org
14 GOOD: 1530507300.raoomurnbf.astroid@strange.none
15 GOOD: 1258787708-21121-2-git-send-email-keithp@keithp.com
16 EOF
17 test_expect_equal_file EXPECTED OUTPUT
18
19 test_begin_subtest "leading and trailing space is OK"
20 ${TEST_DIRECTORY}/message-id-parse <<EOF >OUTPUT
21    <018b1a8f2d1df62e804ce88b65401304832dfbbf.1346614915.git.jani@nikula.org>
22 <1530507300.raoomurnbf.astroid@strange.none>    
23     <1258787708-21121-2-git-send-email-keithp@keithp.com>
24 EOF
25 cat <<EOF >EXPECTED
26 GOOD: 018b1a8f2d1df62e804ce88b65401304832dfbbf.1346614915.git.jani@nikula.org
27 GOOD: 1530507300.raoomurnbf.astroid@strange.none
28 GOOD: 1258787708-21121-2-git-send-email-keithp@keithp.com
29 EOF
30 test_expect_equal_file EXPECTED OUTPUT
31
32 test_begin_subtest "<> delimiters are required"
33 ${TEST_DIRECTORY}/message-id-parse <<EOF >OUTPUT
34 018b1a8f2d1df62e804ce88b65401304832dfbbf.1346614915.git.jani@nikula.org>
35 <1530507300.raoomurnbf.astroid@strange.none
36 1258787708-21121-2-git-send-email-keithp@keithp.com
37 EOF
38 cat <<EOF >EXPECTED
39 BAD: 018b1a8f2d1df62e804ce88b65401304832dfbbf.1346614915.git.jani@nikula.org>
40 BAD: <1530507300.raoomurnbf.astroid@strange.none
41 BAD: 1258787708-21121-2-git-send-email-keithp@keithp.com
42 EOF
43 test_expect_equal_file EXPECTED OUTPUT
44
45 test_begin_subtest "embedded whitespace is forbidden"
46 ${TEST_DIRECTORY}/message-id-parse <<EOF >OUTPUT
47 <018b1a8f2d1df62e804ce88b65401304832dfbbf.1346614915 .git.jani@nikula.org>
48 <1530507300.raoomurnbf.astroid  @strange.none>
49 <1258787708-21121-\f2-git-send-email-keithp@keithp.com>
50 EOF
51 cat <<EOF >EXPECTED
52 BAD: <018b1a8f2d1df62e804ce88b65401304832dfbbf.1346614915 .git.jani@nikula.org>
53 BAD: <1530507300.raoomurnbf.astroid     @strange.none>
54 BAD: <1258787708-21121-\f2-git-send-email-keithp@keithp.com>
55 EOF
56 test_expect_equal_file EXPECTED OUTPUT
57
58
59 test_begin_subtest "folded real life bad In-Reply-To values"
60 ${TEST_DIRECTORY}/message-id-parse <<EOF >OUTPUT
61 <22597.31869.380767.339702@chiark.greenend.org.uk> (Ian Jackson's message of "Mon, 5 Dec 2016 14:41:01 +0000")
62 <20170625141242.loaalhis2eodo66n@gaara.hadrons.org>  <149719990964.27883.13021127452105787770.reportbug@seneca.home.org>
63 Your message of Tue, 09 Dec 2014 13:21:11 +0100. <1900758.CgLNVPbY9N@liber>
64 EOF
65 cat <<EOF >EXPECTED
66 BAD: <22597.31869.380767.339702@chiark.greenend.org.uk> (Ian Jackson's message of "Mon, 5 Dec 2016 14:41:01 +0000")
67 BAD: <20170625141242.loaalhis2eodo66n@gaara.hadrons.org>  <149719990964.27883.13021127452105787770.reportbug@seneca.home.org>
68 BAD: Your message of Tue, 09 Dec 2014 13:21:11 +0100. <1900758.CgLNVPbY9N@liber>
69 EOF
70 test_expect_equal_file EXPECTED OUTPUT
71
72
73 test_done