]> git.notmuchmail.org Git - notmuch/blob - test/cat
Add 'cat' subcommand
[notmuch] / test / cat
1 #!/bin/bash
2
3 test_description='notmuch cat'
4 . ./test-lib.sh
5
6 test_begin_subtest "Generate some messages"
7 generate_message
8 generate_message
9 output=$(NOTMUCH_NEW)
10 test_expect_equal "$output" "Added 2 new messages to the database."
11
12 test_begin_subtest "Without arguments"
13 output=$(notmuch cat 2>&1)
14 test_expect_equal "$output" "Error: notmuch cat requires at least one search term."
15
16 test_begin_subtest "Attempt to cat multiple messages"
17 output=$(notmuch cat "*" 2>&1)
18 test_expect_equal "$output" "Error: search term did not match precisely one message."
19
20 test_begin_subtest "Cat a message"
21 output=$(notmuch cat id:msg-001@notmuch-test-suite)
22 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
23 To: Notmuch Test Suite <test_suite@notmuchmail.org>
24 Message-Id: <msg-001@notmuch-test-suite>
25 Subject: Test message #1
26 Date: Tue, 05 Jan 2001 15:43:57 -0000
27
28 This is just a test message (#1)"
29
30 test_begin_subtest "Cat another message"
31 output=$(notmuch cat id:msg-002@notmuch-test-suite)
32 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
33 To: Notmuch Test Suite <test_suite@notmuchmail.org>
34 Message-Id: <msg-002@notmuch-test-suite>
35 Subject: Test message #2
36 Date: Tue, 05 Jan 2001 15:43:57 -0000
37
38 This is just a test message (#2)"
39
40 test_done