Commit graph

107 commits

Author SHA1 Message Date
Carl Worth
08c735c58e test: Don't strip portions of test name after '-' for temporary files.
We have test names like maildir-sync now, so it's cleaner if the
temporary files created are named things like maildir-sync-10.out
rather than maildir-10.out. Presumably the extra stripping here came
from naming conventions in git's test suite.
2010-11-10 13:09:31 -08:00
Carl Worth
f8007ecb29 test: Add test for viewing raw message within emacs.
This provides further coverage for the recently added (and recently
modified) use of "notmuch show --format=raw" within emacs.
2010-11-06 14:33:30 -07:00
Carl Worth
81d3bd3670 Rename "notmuch cat" to "notmuch show --format=raw"
This is part of an effort to avoid proliferation of excessive
top-level notmuch commands. Also, "raw" better captures the
functionality here, (as opposed to "cat" which is a fairly oblique
reference to a bad Unix abbreviation whose metaphor doesn't work here
since "notmuch cat" operates only on a single message and hence cannot
"con'cat'enate" anything).
2010-11-06 12:03:51 -07:00
Carl Worth
581ea7c8d3 test: Add test for saving an attachment from emacs
This tests the use of "notmuch cat" recently added to the emacs
interface.
2010-11-06 11:25:56 -07:00
Michal Sojka
d39d0e55f0 Add 'cat' subcommand
This command outputs a raw message matched by search term to the
standard output. It allows MUAs to access the messages for piping,
attachment manipulation, etc. by running notmuch cat rather then
directly access the file. This will simplify the MUAs when they need
to operate on a remote database.

Edited-by: Carl Worth <cworth@cworth.org>: Remove trailing whitespace,
add missing "test_done" to new test script to avoid "Unexpected exit"
error.
2010-11-05 17:51:18 -07:00
Carl Worth
1fe7483d8d Makefile: Support "make check" as alias for "make test"
I'm told that some people have been trained by autotools to expect
this target name.
2010-11-05 17:51:18 -07:00
Carl Worth
fd16b37dc1 test: Don't mess with user's HOME directory
This was too rude of a thing to do and could easily introduce
problems, (as reported by Rob Browning whose environment required some
HOME-specific things for shell startup).

Instead, implement more focused changes to ensure that particular file
in $HOME don't cause problems. Specifically, we fix known problems
with ~/.signature and ~/.mailrc here.
2010-11-05 17:43:27 -07:00
Carl Worth
484639453a test: Update mail corpus with original mails (with attachments).
The original mails used to pupulate the mail corpus had had their
attachments (obnoxiously) scrubbed by the pipermail mail archiver.
Since we actually want to test the handling of attachments, this is
less than useful. Restore these files from my own collection, (with
some Received and similar headers pruned).
2010-11-05 17:19:51 -07:00
Carl Worth
2d4b3e3348 test: Clear the "BROKEN" flag on an existing emacs test
I still don't know everything about how I want search order to be
customizable, but I do like the current defaults, (namely, performing
a new search gives results newest first, but performing a saved search
like "tag:inbox" gives results as oldest first).

Until we come up with a better plan for people to select what *they*
want, (rather than just getting what I want), let's codify the current
results in the test suite.
2010-11-05 17:19:51 -07:00
Carl Worth
a09921bdfb test: Generate a little run_emacs script to help debug any failures.
After any emacs test failure, the tmp.emacs directory will have this
run_emacs script in it which the user can use to run emacs within the
test suite environment, (pointing at the test suite's notmuch
database, using the local notmuch command-line program, and the local
notmuch emacs lisp code).
2010-11-05 17:19:51 -07:00
Michal Sojka
c6b59ea3c6 test: Search for non-existent message should return nothing
My scripts expect that empty search result is actually empty. Since
commit 6dcb7592, even empty search prints a newline character and this
breaks my scripts.

This patch adds a test for this bug. In the test I cannot use
test_expect_equal function as $() operator suppresses the final
newline and this kind of difference is not detected.

 test/search |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
2010-11-04 12:34:33 -07:00
Carl Worth
3fe90a955e test: Test emacs notmuch-hello with no saved searches to display.
Haippily, this works just fine, but we might as well test that.
2010-10-29 15:53:34 -07:00
Carl Worth
dec2d57fbc test: Test emacs notmuch-hello when displaying a saved search with 0 results.
This test verifies that the bug fix in the previous commit is working.
2010-10-29 15:50:42 -07:00
Carl Worth
20018a0c09 test: Emit a friendly error message if run with bash < 4.0.
The bash code in the test suite is using associative arrays which were
only added to bash as of release 4.0.

If the test suite is run with an older bash, we now immediately error
out and explain the situation, (instead of emitting confusing error
messages and failing dozens of tests, which is what happened before
this change).
2010-10-28 12:07:42 -07:00
Carl Worth
4884f5496c test: Avoid using unreliable, hard-coded thread ID values in test suite.
Some recently-added tests used hard-coded thread ID values in search
specifications. This is unreliable since the thread IDs depend on the
order in which "notmuch new" encounters new files, (which in turn can
depend on inode ordering within the filesystem).

Fix these by using the new "notmuch search --output=threads" to find the
correct thread IDs given a hard-coded (but reliable) message ID.
2010-10-28 11:45:50 -07:00
Carl Worth
76f1c84e6f test: Add test for reply functionality within emacs.
The reply is primarily taken care of by "notmuch reply" which is already
thoroughly tested. But a recent bug is inserting a duplicate From header
in the emacs-based reply. So exercise that bug here.
2010-10-27 18:43:09 -07:00
Jameson Rollins
04b27c0d4c test: Update tests with removal of bcc from reply
Update the tests so that they no longer expect the Bcc header in the
output of "notmuch reply" now that it has been removed.

Edited-by Carl Worth: Simply applying the change to our newly
modularized test suite.
2010-10-27 17:34:31 -07:00
Carl Worth
1aae106be5 test: Add test for fully-roundtripped FCC
We test that the message we sent via (fake) SMTP is included in the mail
index after a "notmuch new". This verifies that the FCC setting indeed
successfully saved the sent message within the notmuch mail store.
2010-10-27 17:08:09 -07:00
Carl Worth
7123e63b00 test: Use an explicit date in the message sent via (fake) SMTP
Simply setting an explicit date is cleaner than letting the current,
(arbitrary), date get generated for the email message and then constantly
filtering that date out of search results.
2010-10-27 17:06:26 -07:00
Carl Worth
36dcbdeff6 emacs: Explicitly set the From address when composing a new message.
Previously, underlying emacs code was setting this header. Now, we do the
right thing and query the notmuch configuration for the default value here.
2010-10-27 17:04:48 -07:00
Carl Worth
a3883a7e17 emacs: Enable FCC (to a directory named "sent") by default.
Now that the FCC code is fixed to use the notmuch database path, we can
actually enable this by default, which should be highly useful for all
new users of notmuch.
2010-10-27 17:02:44 -07:00
Carl Worth
6c65fcd9aa TODO: Note idea for a new "notmuch compose"
Which would also allow the recently added test of sending an email
message with the emacs interface to be a little more honest about the
From address.
2010-10-27 10:48:40 -07:00
Carl Worth
102c57c825 test: Add test that emacs interface actually sends mail.
Rather than *reall* sending mail here, we instead have a new test
program, smtp-dummy which implements (a small piece of) the
server-side SMTP protocol and saves a mail message to the filename
provided. This gives us reasonable test coverage of a large chunk of
the notmuch+emacs code base (down to talking to an SMTP server with
the final mail contents).
2010-10-27 10:42:46 -07:00
Carl Worth
f30200a429 test: Set alternate HOME during tests.
We set the HOME environment variable to the test directory to avoid
the tests relying on any configuration files from the test author's
own home directory, (such as ${HOME}/.emacs or similar).
2010-10-27 10:40:44 -07:00
Carl Worth
fad0c3b00b test: Fix false failure from the "available tests" test.
We recently added a new sub-directory below test, so we have to
blacklist it explicitly in this test.
2010-10-22 18:03:39 -07:00
Carl Worth
4606ea60a7 emacs: Fix quoting of Message-Id to fix test case of Id containing ".."
If Xapian sees unquoted ".." as in id:123..456 then it thinks that's a
range specification. We avoid this problem by instead passing
id:"123..456" to Xapian.
2010-10-22 17:41:40 -07:00
Carl Worth
4c998189b7 test: Add test demonstrating failure in emacs interface when Message-Id has ..
Thanks to Jameson Rollins for pointing out this bug
(id:87y6g7zr6q.fsf@servo.finestructure.net).
2010-10-22 17:38:38 -07:00
Carl Worth
a9849caadf test: Add tests for adding/removing tags within emacs interface
Exercising both the notmuch-search and notmuch-show views.
2010-10-22 17:17:00 -07:00
Carl Worth
a8aa437bbc test: Add simple tests for navigating notmuch-hello and notmuch-search views
We simulate the act of selecting the "inbox" saved search from
notmuch-hello and the act of selecting a desired thread from the
notmuch-search results.

The test for the navigation of notmuch-hello is currently marked as
BROKEN since its output is in the opposite order compared to the
'(notmuch-search "tag:inbox")' test. This question of ordering is a
currently open issue on the notmuch mailing list, so we'll let the
test suite reflect that for now.

Finally, this commit also abstracts some common emacs lisp code,
(waiting for the current buffer's process to complete), into a new
notmuch-test-wait function that is made available to anything calling
test_emacs.
2010-10-22 17:02:07 -07:00
Carl Worth
6307f306fd test: Add a new test_expect_equal_failure
Which allows us to have a known-broken test that would otherwise use
test_expect_equal.
2010-10-22 17:01:34 -07:00
Carl Worth
4bb1b1603c test: Add tests for emacs notmuch-search and notmuch-show functions.
Moving the expected output into individual files (rather than inline)
to keep the test script much easier to read.
2010-10-22 16:58:35 -07:00
Carl Worth
ca956552bd emacs: Remove the joke from the first line of the notmuch-hello view.
Overuse just makes the joke unfunny.
2010-10-22 12:12:22 -07:00
Carl Worth
1375d71ff4 test: Add the most rudimentary testing of the emacs interface.
So far, this is doing nothing more than adding a corpus of email and
ensuring that the `notmuch-hello' function produces the desired
output.
2010-10-22 12:10:15 -07:00
Carl Worth
209e756cd4 test: Add a new test_emacs function to test-lib.sh
This should be quite handy for doing automated testing of the
emacs-based functionality in notmuch. This function invokes emacs with
the necessary command-line arguments, (to run in batch mode with no
local initialization, to load the notmuch code from the source
directory, and to ensure an 80-column width).
2010-10-22 12:09:56 -07:00
Carl Worth
b97a763dc1 test: Fix add_email_corpus function to be quiet.
This simply avoids some unneeded noise in the "make test" output.
2010-10-22 12:04:41 -07:00
Carl Worth
9c7fd320c9 test/README: Document add_email_corpus (and add_message/generate_message)
While adding the documentation here for add_email_corpus I noticed
that the other email-adding functions in test-lib.sh were not yet
documented here, so add all of that documentation.
2010-09-20 16:41:31 -07:00
Carl Worth
5497b01c27 test: Fix the search and dump-restore tests to operator on non-empty mail store.
We do this with a new add_email_corpus function that establishes a
mail store with 50 messages from the notmuch mailing list.
2010-09-20 16:40:35 -07:00
Carl Worth
d805866ec5 test: Add a corpus of email messages to be used in testing.
This is simply 50 messages from the early history of the notmuch mailing
list, (fetched from the public archives).
2010-09-20 16:37:53 -07:00
Carl Worth
ba9f9efc9a test: Remove useless NOTMUCH variable (in favor of simply "notmuch")
When the NOTMUCH variable was originally invented it was used as an
explicit path to the notmuch binary being tested. Today, the test
suite sets the PATH variable instead, so the NOTMUCH variable always
has a value of simply "notmuch".

We simplifying that by using the constant value rather than the
continual variable reference.
2010-09-20 16:15:08 -07:00
Carl Worth
129a4417e3 test: Remove some dead code in test-lib.sh
These assignements weren't being used at all and were just confusing me,
(the real assignments happen later on in the file).
2010-09-20 16:09:20 -07:00
Carl Worth
2b3a219bc9 test: Fix PATH-checking test to work with --valgrind
The --valgrind option munges the PATH variable, so un-munge it before
testing that we have PATH pointing to the source directory.
2010-09-20 15:07:26 -07:00
Carl Worth
341e2bd86e test: Fix to actually report errors (!).
A bug in the results-aggregation code was causing the test suite to report
"all tests passed" even when there were failures, (as long as there were
also no "broken" tests). Fix this.
2010-09-20 14:39:40 -07:00
Carl Worth
49a8cb9de3 test: Avoid printing "Testing Testing ..."
The test suite isn't auditioning for a roadie position, after all.
2010-09-20 14:39:06 -07:00
Carl Worth
4813ee41d6 test: Print section names, and rename all test sections
Now that we can usefully pass section names via the NOTMUCH_SKIP_TESTS
environment variable, it's useful to actually print those names out
for the user. Then, since we're now printing these names, let's use
nicer names, (not excessively long but also not using abbreviations
like "msg").
2010-09-20 14:38:56 -07:00
Carl Worth
169639e606 test: Make the --valgrind option useful, (and drop --verbose).
In order for --valgrind to be useful, we drop noisy additional output of
all of the commands being executed in verbose mode. This makes --verbose
alone quite useless, so we don't document it any more.

Also, add a zlib valgrind suppression that was showing up frequently in the
test suite.
2010-09-20 14:28:13 -07:00
Carl Worth
029a105da3 test/README: Update to become notmuch-specific rather than git-specific
This file was obviously describing the git test suite previously, and
would have been very hard to understand in the context of the notmuch
test suite. HOpefully it's easier to follow now.
2010-09-20 14:06:38 -07:00
Carl Worth
16a6301ade test: Rename GIT_SKIP_TESTS to NOTMUCH_SKIP_TESTS
By scanning test-lib.sh for occurrences of "git" or "GIT", I found
that most of those are internal things, (like the GIT_TEST_TEE_STARTED
variable). But GIT_SKIP_TESTS is part of the user-interface to the
test suite, so we rename it to reference notmuch rather than git.

Also, the GIT_TRACE warning is git-specific, so we drop that as well.
2010-09-20 13:54:57 -07:00
Carl Worth
8369ed31d0 test: Fix notmuch-test to pass command-line arguments to sub-scripts.
The is useful for things like "notmuch-test --valgrind", etc.
2010-09-20 13:45:29 -07:00
Carl Worth
60c599036e test: Fix test suite so that --valgrind option works.
The output is ugly, and we need a better suppressions file, but this
is at least a start.
2010-09-20 13:44:32 -07:00
Carl Worth
265de5006f test: Add test to ensure that all available test scripts are run
Since we are now using an explicit list of tests to run in
notmuch-test we need to be careful that we don't add a new file of
tests and then forget to add it to the list.
2010-09-20 12:41:10 -07:00