Commit graph

127 commits

Author SHA1 Message Date
Austin Clements
9ade8160a6 test: Test atomicity of notmuch new.
This tests notmuch new's ability to recover from arbitrary stopping
failures.  It interrupts notmuch new after every database commit and,
on every resulting database snapshot, re-runs notmuch new to
completion and checks that the final database state is invariant.
2011-09-12 23:36:00 -03:00
Mark Anderson
86e0baeb6d test:Folder tags shouldn't match after removal of file in given folder
Test for bug.  Current stemming support for notmuch adds extra terms
to the DB which aren't removed when the file renames are detected.

When folder tags are added to a message, Xapian terms for both XFOLDER
and ZXFOLDER are generated.  When one of the filenames are
renamed/removed, only the XFOLDER tags are removed, leaving it possible
for a match on a folder: tag that was previously but is no longer a
match in the maildir.
2011-06-29 14:10:05 -07:00
David Bremner
fba968dbfa tests: add a test for symbol hiding side effects
The worry here is that a binary linking with libnotmuch might lose
access to Xapian::Error symbols because libnotmuch hides them.

We are careful here to create ./fakedb/.notmuch in order to trigger a
Xapian exception, and not just a missing file check.

Thanks to jrollins and amddragon for suggestions.
(cherry picked from commit 66f37f5f6864a988f94ddb893e3a176af57f6c8e)
2011-06-23 07:05:25 -03:00
David Bremner
114eb1c520 tests: Add optional use of timeout utility, if present.
Each top level test (basic, corpus, etc...) is run with a fixed
timeout of 2 minutes.

The goal here is to treat a hung test as a failure. The emacs test for
sending mail is known to be problematic on the Debian
autobuilders. This is both a bandaid fix for that, and a sensible long
term feature.
(cherry picked from commit 5f99c80e02736c90495558d9b88008a768876b29)
2011-06-22 08:11:32 -03:00
Jameson Graef Rollins
627d752501 test: add crypto tests for signature verification and decryption
This adds a new "crypto" test script to the test suite to test
PGP/MIME signature verification and message decryption.  Included here
is a test GNUPGHOME with a test secret key (passwordless), and test
for:

  * signing/verification
  * signing/verification with full owner trust
  * verification with signer key unavailable
  * encryption/decryption
  * decryption failure with missing key
  * encryption/decryption + signing/verfifying
  * reply to encrypted message
  * verification of signature from revoked key

These tests are not expected to pass now, but will as crypto
functionality is included.
2011-05-27 16:22:00 -07:00
Joel Borggrén-Franck
3fa843216c test: change "#!/bin/bash" to "#!/usr/bin/env bash" enhances portability
Change #!/bin/bash at start of tests to "#!/usr/bin/env bash". That way
systems running on bash < 4 can prepend bash >= 4 to path before
running the tests.
2011-05-27 14:03:28 -07:00
Jameson Graef Rollins
04927208fa test: force deletion of test remnants
This keeps the test from failing if only a subset of the remnants were
available for deletion, because e.g. only a subset of the tests were
run.
2011-05-23 14:55:27 -07:00
Jameson Graef Rollins
7058ac2bbe test: allow specifying tests to run with NOTMUCH_TESTS env var
This is useful for just running a specific subset of tests, ie:

NOTMUCH_TESTS=crypto make test
2011-05-23 14:55:27 -07:00
Carl Worth
d67f755497 test: Add a test of "notmuch show" with a multipart message
This tests "notmuch show" with both --format=text and --format=json on
a message with some non-trivial MIME multipart nesting, (multiple parts
within a multipart/mixed part which is within a multipart/signed part).

The test captures the current behavior (where only the leaf nodes of
the MIME structure are emitted as a flat list---the multipart parts
are effectively ignored). We plan to soon change the json output at
least to emit an actual hierarchy matching the MIME structure, (at
which point we will update this test).
2011-05-16 22:21:31 -07:00
Carl Worth
4e414e2a5a Rename/rewrite the new emacs-forgetfulness test (to emacs-large-search-buffer)
The new name is more descriptive of the bug being tested. Also, the test
is rewritten slightly so that it's much more plain to see how the bug
manifests itself, (that messages are droped from the emacs result at
regular intervals). Primarily, this is by collapsing the large blobs
used to inflate the message subjects.
2011-03-10 13:22:04 -08:00
Thomas Schwinge
a3bf541e2b New test: Emacs' forgetfulness.
Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
2011-03-10 12:07:53 -08:00
Carl Worth
f14d4c55ce test: Rename and clarify the search-lwn test
Now that we understand the bug here, we rename this test to
search-insufficient-from-quoting to clarify the bug being exercised,
(which occurs when the From: line contains an unquoted '.' character).

We also mark these tests as expected failures until the bug gets fixed.
2011-03-09 15:10:03 -08:00
Carl Worth
99ad348deb search: Move lwn tests into their own file.
Since it's much easier to debug and fix these if they can be run on
their own.
2011-03-09 15:10:03 -08:00
Michal Sojka
cb6411e291 test: Make it easier to resolve conflicts when adding new tests
Currently, there are two places in the test framework that contain very
long list on a single line. Whenever a test is added (or changed) in
several branches and these branches are merged, it results in conflict
which is hard to resolve because one has to go through the whole long
line to find where the conflict is.

This patch splits these long lists to several lines so that the
conflicts are easier to resolve.
2011-01-26 22:37:21 +10:00
Carl Worth
fb54dee4ac Add test demonstrating a position overlap bug.
Currently, whenever we call index_terms multiple times for a single
field, the term generator is being reset to position 0 each time. This
means that with text such as:

	To: a@b.c, x@y.z

one can get a bogus match by searching for:

	To: a@y.c

Thanks to Mark Anderson for reporting the bug, (and providing a nice,
minimal test case that inspired what is used here).
2011-01-26 15:59:19 +10:00
Carl Worth
600f3761dc test: Add new tests for folder-based searching.
This is a new feature which is not implemente yet, so these tests mostly
fail currently. A subsequent commit will add the feature and cause these
tests to start passing.

These tests verify that we can search for containing folders of mail files
by word or by phrase and that the search terms are updated correctly when
directories are renamed.
2011-01-15 15:37:43 -08:00
Carl Worth
da805c4cdb Revert "test: Break on test script (or other) error"
This reverts commit f22a7ec1e2.

Interrupting the test suite due to an actual bug in a test script
would be just fine, but interrupting the run of the entire test suite
at the first test failure is unacceptable.
2010-12-07 16:23:20 -08:00
Carl Worth
e2a550b968 test: Add simple tests for "notmuch search --output=<>"
This code simply wasn't being exercised by the test suite before, so
this will be useful.

Meanwhile, there's currently a bug in "notmuch search --output=tags"
in that it doesn't print a final newline. But the current test suite
isn't able to catch this bug since the $() construct of the shell
doesn't preserve the distinction of whether the final newline is
present or not.
2010-11-23 17:41:25 -08:00
Michal Sojka
f22a7ec1e2 test: Break on test script (or other) error
Break notmuch-test whenever a test script returns non-zero status.
This happens either when some test from the script fails or when there
is an error in the script.

This is especially useful in the latter case since the error may not
appear in the final aggregated results.
2010-11-16 11:28:06 -08:00
Michal Sojka
736ac42c45 Tests for maildir synchronization
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
2010-11-10 13:09:32 -08: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
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
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
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
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
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
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
7263aa9ec3 test: Rename all tests to get rid of the ugly numbers in file names.
The numbers were meaningless, and they made it hard to find a file of interest.

Instead, we get the ordering we want by adding an explicit list of
tests to run to the notmuch-test script.
2010-09-17 16:01:42 -07:00
Carl Worth
222926abe1 test: Cleanup the test output
This makes the new, git-derived test suite report results in a manner
similar to the original notmuch test suite.

Notable changes include:

  * No more initial '*' on every line
  * Only colorize a single word
  * Don't print useless test numbers
  * Use "PASS" in place of "ok"
  * Begin sentences with a capital letter
  * Print test descriptions for each block
  * Separate each block of tests with a blank line
  * Don't summarize counts between each block
2010-09-17 14:08:36 -07:00
Carl Worth
e6ba2c63c9 test: Fix test suite to integrate with our non-recursive Makefile system.
This avoids "make test" emitting messages from three (3!) recursive
invocations of make. We change the invocations of the tests themselves
to occur directly from the shell script rather than having the shell
script invoke make again and using wildcards in the Makefile.
2010-09-17 12:16:10 -07:00
Michal Sojka
5398e6966a Convert the actual tests to the new framework
The changes are:
- The notmuch-test was split into several files (t000?-*.sh).
- Removed helper functions which were moved to test-lib.sh
- Replaced every printf with test_expect_success.
- Test commands chained with && (test-lib.sh doesn't use "set -e" in
  order to complete the test suite even if something fails)
- Many variables such as ${MAIL_DIR} were properly quoted as they
  contain spaces.
- Changed quoting patterns in add_message and generate_message (single
  quotes are already used by the test framework).
- ${TEST_DIR} replaced by ${PWD}

QUICK HOWTO:

To run the whole test suite
    make

To run only a single test
   ./t0001-new.sh

To stop on the first error
   ./t0001-new.sh -i
then mail store and database can be inspected in
"trash directory.t0001-new"

To see the output of tests
   ./t0001-new.sh -v

To not remove trash directory at the end:
   ./t0001-new.sh -d

To run all tests verbosely:
   make GIT_TEST_OPTS="-v"

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
2010-09-16 15:56:44 -07:00
Carl Worth
9c7668bdb5 Avoid giving GMime a NULL MIME-stream filter.
Micah Anderson reported an issue where a message failed to display in
the emacs interface, (it instead gave an error, "json-read-string: Bad
string format").

Micah tracked this down to the json output from "notmuch show" being
interrupted by a GMime error message:

	gmime-CRITICAL **: g_mime_stream_filter_add: assertion
	`GMIME_IS_FILTER (filter)

I tracked this down further to notmuch passing a NULL value to
g_mime_stream_filter_add. And this was due to calling
g_mime_filter_charset_new with a value of "unknown-8bit".

So we add a test message withe a Conten-Type of "text/plain;
charset=unknown-8bit" from Micah's message. Then we fix "notmuch show"
to test for NULL before calling g_mime_stream_filter_add. Bug fixed.
2010-06-05 08:40:26 -07:00
Carl Worth
7b78eb4af6 Add support (and tests) for messages with really long message IDs.
Scott Henson reported an internal error that occurred when he tried to
add a message that referenced another message with a message ID well
over 300 characters in length. The bug here was running into a Xapian
limit for the length of metadata key names, (which is even more
restrictive than the Xapian limit for the length of terms).

We fix this by noticing long message ID values and instead using a
message ID of the form "notmuch-sha1-<sha1_sum_of_message_id>". That
is, we use SHA1 to generate a compressed, (but still unique), version
of the message ID.

We add support to the test suite to exercise this fix. The tests add a
message referencing the long message ID, then add the message with the
long message ID, then finally add another message referencing the long
ID. Each of these tests exercise different code paths where the
special handling is implemented.

A final test ensures that all three messages are stitched together
into a single thread---guaranteeing that the three code paths all act
consistently.
2010-06-04 13:35:07 -07:00
Carl Worth
77ab738343 test suite: Generate message filenames from count, not Message-Id.
We're about to add a test with an excessively long message-id, (512
characters or so). This exceeds filename length limits, so just always
the simple counter to generate the filenames, (which we were doing for
messages with non-custom IDs anyway).
2010-06-04 12:38:11 -07:00
Carl Worth
552c61e269 test suite: Add support for custom references header in generated messages.
In the same style as several other existing headers.
2010-06-04 12:36:13 -07:00
Carl Worth
33765e5c2e Add a test case for the previous commit.
The commit said it fixed a problem with headers >200 characters
long. But examination of the code suggests that it was a header of
exactly 200 characters long that caused the problem. So we add a test
case for that here.

Before the fix in the previous commit, valgrind would detect many
errors when replying to the message created with this test case. After
that commit, those errors are gone.
2010-06-03 16:43:21 -07:00
Carl Worth
e0f5610498 test: Exercise magic-from guessing with a single configured address
Immediately after releasing 0.3 we learned that the magic-from-guessing
code could hang in an infinite loop in some cases. The bug occurred
only when the user had configured only a primary email addresss and no
other email addresses.

The test suite wasn't previously covering this case, so address this
shortcoming.
2010-04-27 10:13:04 -07:00
Dirk Hohndel
a35a9a77af Add tests for author name reordering in search results
This should be required for all patches :-)

Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
2010-04-26 11:45:17 -07:00
Michal Sojka
969f1c4621 test: Comment why we need to set TZ 2010-04-26 08:05:57 -07:00
Dirk Hohndel
8adaad690e fix expected test result to include Bcc lines
this test actually tests behavior that I consider as broken.
The Bcc should be to the same address as used in the From line,
otherwise we are creating a potential information leak as email
that is related to one email account (say, work) is copied to
a different account

Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
Reviewed-by: Carl Worth <cworth@cworth.org>

These tests don't actually pass yet, since the feature being tested
has not been merged. But gettting these tests in first will let us
more easily test that the feature actually works, (and will help us
ensure we don't forget the feature before the next release).
2010-04-23 17:01:49 -07:00
Dirk Hohndel
037cfc5f5a add From guessing tests to test suite
right now these are not trying to be overly fancy
simply one test per strategy that we apply to figure out the best
from address - including the fallback if there's nothing to go on

Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
2010-04-23 17:01:19 -07:00
Michal Sojka
f106db3e9b test: Set fixed time zone
When the test suite is run in a different time zone that where Carl
lives, some tests may fail depending on the time when the test suite is
run. For example, just now I get:

     Search for all messages ("*"):...			FAIL
    --- test-031.expected	2010-04-23 09:33:47.898634822 +0200
    +++ test-031.output	2010-04-23 09:33:47.898634822 +0200
    @@ -1,5 +1,5 @@
    -thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #6 (inbox unread)
    -thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #14 (inbox unread)
    +thread:XXX   2001-01-06 [1/1] Notmuch Test Suite; Test message #6 (inbox unread)
    +thread:XXX   2001-01-06 [1/1] Notmuch Test Suite; Test message #14 (inbox unread)
     thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)
     thread:XXX   2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)
     thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)

By setting a fixed time zone in the test script, these problems should
be eliminated.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
2010-04-23 13:28:33 -07:00
Carl Worth
ec6d78acf1 test: Put the json tests into their own section.
Not that the sections actually mean anything yet, but it makes for
clean output.
2010-04-22 17:17:11 -07:00
Gregor Hoffleit
08deef5f75 First tests for JSON output and UTF-8 in mail body and subject
The test suite doesn't yet cover --format=json output nor UTF-8 in
subject or body.

This patch starts with test cases for 'search --format=json' and
'show --format=json'.

Furthermore, it has test cases for a search for a UTF-8 string in a mail
body for a UTF-8 string in a mail subject.

Finally, it has a test case for --format=json with UTF-8 messages,
demonstrating the fix in 1267697893-sup-4538@sam.mediasupervision.de.

Reviewed-by: Carl Worth <cworth@cworth.org>
Updated tests to current implementation of the test suite.
These tests demonstrate a bug in the current implementation
of "notmuch show --format=json", (timestamp output is changed
depending on current timezone).
2010-04-22 17:10:23 -07:00
Carl Worth
e31aa92a4c test: Make existing "notmuch show" test more resilient
If future updates to the test suite add more messages to the database
before this "notmuch show" test, then the message-ID numbers in the
expected output will all change. But we can at least compute the
numbers so that this test will continue to pass.
2010-04-22 17:08:08 -07:00
Carl Worth
5106df9f6b test: Add a test to demonstrate message-sorting regression.
In the recent change to rename threads based on changing subject
lines, I broke message ordering within "notmuch show" output. But our
test suite didn't catch that regressions, because we didn't have any
tests of "notmuch show".

This adds one "notmuch show" test along with the thread-naming
tests. It's not a whole suite of "notmuch show" testing, but it does
catch this regression at least.
2010-04-22 13:26:37 -07:00
Carl Worth
01f03cf098 test: When a test fails, show diff only (save complete output to a file)
We're starting to get test output that's fairly long, so it's much
kinder to just show a diff rather than displaying the complete
expected and actual output. To allow the user to investigate things
after the fact, we save the expected and actual output to files named
test-${test_number}.expected and test-${test_number}.output .
2010-04-22 13:22:08 -07:00
Carl Worth
9a3d4a0f2a test: Improve grammar in test-message subjects.
Before codifying these in any expected test output, I'd like them to
at least resemble English.
2010-04-22 13:21:15 -07:00
Carl Worth
2a1a4f0551 test: Add tests for naming threads with changing subjects.
We recently added a feature to name threads based on the messages that
actually matched the search, (as opposed to simply the oldest or
newest message in the thread whether it matched or not). So add tests
for that, and (surprise, surprise!) the feature does not entirely
work.
2010-04-21 15:50:33 -07:00
Carl Worth
cddeaa59ab make test: Actually count and report on failures.
Hurrah---no more manual verification of that PASS column.

This means that "make test" can actually be a useful part of the
release process now, (since it will exit with non-zero status if there
are any failures).
2010-04-15 15:18:30 -07:00
Carl Worth
004ed3362f test: Unify all tests to use the pass_if_equal function.
Previously some tests (dump/restore) were doing ad-hoc verification of
values and their own printing of PASS/FAIL, etc. This made it
impossible to count test pass/fail rates in a single place.

The only reason these tests were written that way was because the old
execute_expecting function only worked if one could directly test the
stdout output of a notmuch command. The recent switch to pass_if_equal
means that all tests can use it.
2010-04-15 15:09:21 -07:00
Carl Worth
6d16e5c7a3 test: Align the PASS/FAIL column.
Just to make things a little more pleasant to look at.
2010-04-15 15:06:00 -07:00
Carl Worth
f0050f6dd2 test: Add a test for "notmuch search '*'"
This feature was added recently and should have gotten a new test at
the time.

As this test demonstrates, the code is broken, ("notmuch search '*'
returns bogus dates of the Unix epoch for any threads where the
term "and" does not appear in any messages).
2010-04-15 14:48:56 -07:00
Carl Worth
d49eef0a3f test: Use an older date for the generated messages.
Using a date in the current year makes the test suite fragile since
the search output will include a date of "January 05" for now, but
will start doing "2010-01-05" in the future.
2010-04-15 14:13:12 -07:00
Carl Worth
9c0ae2e73e test: Remove test-message filenames from generated messages
The filenames aren't predictable (including the current directory) nor
stable from one run to the next (including the PID). This makes it
hard to predict the output from a search command that returns such a
message (such as "*").

The original goal was simply to ensure that each generated message was
distinguishable somehow. So just use the message counter instead.
2010-04-15 14:13:12 -07:00
Carl Worth
3846c1d12c test: Disentangle execution of notmuch from the examination of the results.
The old execute_expecting function was doing far too much for its own
good.  One of the worst aspects of this was that it introduced
shell-quoting challengers where the caller could not easily control
the precise invocation of the command to be executed.

I personally couldn't find a way to test "notmuch search '*'" without
the shell expanding * against files in the current directory, or
having bogus quotation marks appearing in the search string,
(defeating the recognition of "*" as a special search term).

Hopefully this aspect of the test suite will be much easier to maintain now.
2010-04-15 14:13:12 -07:00
Carl Worth
f1776f8b51 test: Fix reply tests to track insignificant change in output.
The recent fix to properly decode encoded headers made the expected
output of "notmuch reply" differ by a single space, (previously, there
were two spaces before the References: value and now there is just
one).

Fix the test suite so that these are all noted as correct results
again.
2010-04-14 17:17:50 -07:00
James Westby
4a9b41f1da test: Add new tests for out-of-order messages.
These new tests demonstrate a bug as follows:

  Multiple messages are added to the database

  All of these message references a common parent

  The parent message does not exist in the databas

In this scenario, the messages will not be recognized as belonging to
the same thread. We consider this a bug, and the new tests treat this
as a failure.

Edited by Carl Worth <cworth@cworth.org>: Split these tests into their
own commit (before the fix of the bug). This lets me see the actual
failure in the test suite, before the fix is applied. Also fix the
alignment of new messages from test suite, (so that the PASS portions
all line up---which is important while we're still manually verifying
test-suite results).
2010-04-12 14:04:35 -07:00
Carl Worth
bf09c7d11e test: Fix phrase-search tests.
With some extra qutotation marks, we are now doing actual phrase
searches so these tests pass.
2010-03-31 13:31:09 -07:00
Carl Worth
70b7e659f6 test: Add some negative results for the phrase searches.
These results have all the same terms as the target phrase, but
not in the expected order. They are designed to ensure that we
actually test phrase searches.

And as it turns out, we're not currently quoting the search terms
properly, so the phrase-search tests now fail with this commit.
2010-03-31 13:31:09 -07:00
Carl Worth
9439b217c3 Switch from random to sequential thread identifiers.
The sequential identifiers have the advantage of being guaranteed to
be unique (until we overflow a 64-bit unsigned integer), and also take
up half as much space in the "notmuch search" output (16 columns
rather than 32).

This change also has the side effect of fixing a bug where notmuch
could block on /dev/random at startup (waiting for some entropy to
appear). This bug was hit hard by the test suite, (which could easily
exhaust the available entropy on common systems---resulting in large
delays of the test suite).
2010-02-09 11:14:11 -08:00
Carl Worth
ef8a74944c notmuch-test: Add basic tests for "notmuch dump" and "notmuch restore"
Our test-suite coverage keeps improving, (slowly).
2010-02-05 17:28:25 -08:00
Carl Worth
b918e04ee8 notmuch-test: Fix misalignment in output.
Clean output is just so much easier to read (and validate).
2010-02-05 17:27:22 -08:00
Carl Worth
a47bf6e7dc notmuch-test: Add test to verify that uuencoded data is not indexed.
As recently promised, no new features are being accepted to notmuch
without corresponding new tests for the test suite.
2010-02-05 10:33:11 -08:00
Carl Worth
bc79dc9d6c notmuch-test: Add several tests of "notmuch search"
These tests were surprisingly simple to write---not much code at all
and most of them worked the first time even with hand-prepared
versions of the expected output.
2010-02-05 10:33:06 -08:00
Carl Worth
5c938e51b2 notmuch-test: Add a new add_message function.
The previous generate_message function is what's needed when testing
"notmuch new". But after that, we never want to generate a message
without also adding it to the index. So create a new add_message
function with this convenience.
2010-02-04 17:34:48 -08:00
Carl Worth
9041c1389c notmuch-test: Test "notmuch reply" with a reply-to-munged mail
This is a test for the recently added feature where we detect that the
reply-to address already exists in the To: or Cc: header so will
already be replied to. In this case we want to include the From:
address in our reply, (where, otherwise we would use the Reply-To
address *instead* of the address in the From header).
2010-02-04 12:42:03 -08:00
Carl Worth
bcba87a3e2 notmuch-test: Test "notmuch reply" with multiple recipients
The feature tested here is that we reply to both the sender and to
others addresses on the To: line of the original message, but that we
don't reply to our own address.
2010-02-04 12:10:43 -08:00
Carl Worth
fbe595e3b9 notmuch-test: Add test for "notmuch reply" with a CC header.
A simple test to help round out the set of tested features.
2010-02-04 12:10:43 -08:00
Carl Worth
96134fc723 notmuch-test: Add "notmuch reply" test for reply-to support.
This is the standard support of reply-to, (replying to that address
rather than the from address). It has nothing to do with the proposed
feature for extra-clever handling of a mail from a mailing-list that
has munged the reply-to header.
2010-02-04 12:10:43 -08:00
Carl Worth
33f55e43e1 notmuch-test: Test "notmuch reply" from alternate address.
When reply to a message addresses to an address configured in the
other_email setting in the configuration file, the reply should use
that address in the From header. Test this.
2010-02-04 12:10:43 -08:00
Carl Worth
4e66b777cf notmuch-test: Add a basic test of "notmuch reply"
Simply ensuring that the reply template is formatted as expected.
2010-02-04 12:10:42 -08:00
Carl Worth
5a4532860c notmuch-test: Eliminate sleeps to speed up test suite run
We were sleeping merely to ensure that our updates to the mail store
would result in the mtime of the appropriate directories being
updated. We make the test suite run faster by not sleeping, but
instead explicitly updating the mtime of the directory to a future
time with touch.

We're careful to ensure that the time is not merely in the future
compared to the current time, but also later than any previous update
to the same directory mtime.
2010-02-04 12:10:42 -08:00
Carl Worth
a821ba5737 notmuch-test: Allow custom headers when generating messages
This provides the control that future tests will need, (for example,
adding a CC field to ensure proper handling with "notmuch reply",
etc.)
2010-02-04 08:44:05 -08:00
Carl Worth
0d67c52f4d notmuch-test: Use named-parameters for generate_message function
This makes the test suite bash-specific, but that's not much of
an issue for me, (if somebody else would prefer some other language
then they can rewrite the test suite and maintain it).

The advantage here is that we'll now be able to easily generate
custom messages for testing operations that depend on the message
content, (such as "notmuch reply", etc.).
2010-02-04 08:44:05 -08:00
Carl Worth
8d37b2f982 Add actual testing to notmuch-test
We verify that each command creates output exactly as expected (after
ignoring variable output such as the report of how long an operation
took).
2010-02-04 08:44:05 -08:00
Carl Worth
a2d919eb2f Add a very rough beginning of a test suite.
This notmuch-test script simply runs a few different notmuch operations,
(things that I found were useful while testing the rename-support code).

It's not useful as a test suite yet, since it doesn't actually check
the results of any operation, (the user of the suite has to know what
the results should be and must manually verify them. So there's no
integration with the build system yet, (no "make test" target).

But I didn't want to lose what I had so far, so here it is.
2010-01-24 07:36:39 +13:00