Commit graph

103 commits

Author SHA1 Message Date
Peter Feigl
76271e098c Adding tests for --format=sexp.
Add basic tests, the same as for json, for the S-Expression output
format.
2012-12-08 09:30:46 -04:00
David Bremner
a09115ae1d test/hex-escaping: new test for hex escaping routines
These are more like unit tests, to (try to) make sure the library
functionality is working before building more complicated things on
top of it.
2012-12-02 15:51:32 -04:00
Austin Clements
ec59896de0 test: Abort driver if a test script aborts
Previously, if a test script aborted (e.g., because it passed too few
arguments to a test function), the test driver loop would simply
continue on to the next test script and the final results would
declare that everything passed (except that the test count would look
suspiciously low, but maybe you just misremembered how many tests
there were).

Now, if a test script exits with a non-zero status and did not produce
a final results file, we propagate that failure out of the driver loop
immediately.

To keep this simple, this patch removes the PID from the test-results
file name.  This PID was inherited from the git test system and seems
unnecessary, since the file name already includes the name of the test
script and the test-results directory is created anew for each run.
2012-11-29 09:24:12 -04:00
Jani Nikula
84a0c529b9 test: add tests for date:since..until range queries
A brief initial test set.
2012-10-31 17:14:07 -03:00
Jani Nikula
58b222d597 test: add smoke tests for the date/time parser module
Test the date/time parser module directly, independent of notmuch,
using the parse-time test tool.

Credits to Michal Sojka <sojkam1@fel.cvut.cz> for writing most of the
tests.
2012-10-31 16:50:57 -03:00
Austin Clements
36e640852b test: Add test for messages with missing headers
Currently the JSON tests for search and show are broken because
notmuch attempts to dereference a NULL pointer.
2012-08-12 21:06:50 +02:00
Peter Wang
9d70e952eb test: add basic show, search --format=text tests
There didn't seem to be these basic tests for --format=text,
as there are for --format=json.  These are just the tests from
the `json' script, with adjusted expected outputs.
2012-07-09 15:43:40 -06:00
Peter Wang
b8c7707d4d test: Add tests for 'config' command
Start a new test script.
2012-04-28 10:14:10 -03:00
Mark Walters
6478e1bc92 test: add some exclude tests
Systematically test the exclude options for search. Also move the
search existing exclude tests into the new test. There is some overlap
between the two sets of tests but many of the existing ones are there
because they triggered bugs in the past so I have kept them to ensure
coverage.
2012-04-07 23:06:21 -03:00
Daniel Schoepe
6e25ea031f emacs: Tests for user-defined sections
A new file was added for notmuch-hello tests.
2012-03-01 08:16:55 -04:00
Dmitry Kurochkin
69adeb52b1 test: add test for hiding Original Message region at beginning of a message
The test is currently broken and will be fixed by a subsequent patch.

The patch adds a new file for tests of Emacs notmuch-show view.

Based on patch by David Edmondson [1].

[1] id:"1327562380-12894-4-git-send-email-dme@dme.org"
2012-02-04 07:32:54 -05:00
Dmitry Kurochkin
6dec2af55b test: remove ".sh" extension from the recently added Emacs tests
All test files, except for the recently added Emacs tests, do not have
".sh" extension.  So remove it from the new test files for consistency.
2012-02-03 21:12:12 -04:00
David Edmondson
3699fedb3a test: Add address cleaning tests. 2012-01-25 07:27:01 -04:00
David Edmondson
260975e8af test: Add `test_emacs_expect_t'.
Add a new test function to allow simpler testing of emacs
functionality.

`test_emacs_expect_t' takes one argument - a lisp expression to
evaluate. The test passes if the expression returns `t', otherwise it
fails and the output is reported to the tester.
2012-01-25 07:25:44 -04:00
Mark Walters
15ea8625d1 test: add tests for "notmuch reply" --reply-to=sender 2012-01-14 11:11:18 -04:00
Jani Nikula
02052781a9 test: emacs: test notmuch-wash-subject-to-* functions
Signed-off-by: Jani Nikula <jani@nikula.org>
2011-12-28 08:18:40 -04:00
Jani Nikula
caae152772 test: add tests for hooks
Signed-off-by: Jani Nikula <jani@nikula.org>
2011-12-11 13:59:39 -04:00
David Bremner
5800a44bd5 test: tests for command-line-arguments.c
This was needed because no current notmuch code exercises the
NOTMUCH_OPT_STRING style arguments.
2011-12-08 20:24:24 -04:00
David Bremner
f0e0053149 Merge branch 'release'
Conflicts:
	NEWS

Conflicts resolved by inserting the 0.10.2 stanza before 0.11
2011-12-06 19:39:33 -04:00
David Bremner
6cca3a5c16 test: add tests for python bindings
We start modestly, with a (slightly modified) test case from Kazuo
Teramoto. Originally it just made sure the bindings didn't crash; here
we check that by comparing the output with that of notmuch search.
2011-12-05 18:06:48 -04:00
David Bremner
ac8576de63 Merge branch 'release' 2011-11-26 21:15:20 -08:00
David Bremner
398b94bb39 test: add simple tests for online help
Nothing fancy, but we can at least detect segmentation faults.
2011-11-25 12:35:40 -05:00
Tomi Ollila
6237f3808c test: make all tests terminable with Ctrl-c
Some tests don't break when HUP signal is sent tho those (by
pressing ctrl-c on the terminal). Therefore, the top-level
test script catches the HUP and sends TERM signal to the
started test script.
2011-11-18 13:53:51 -05:00
Jani Nikula
8a4d631d7c test: add tests for notmuch search --offset and --limit
Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-15 19:25:58 -04:00
Jani Nikula
28d78c2b02 test: add tests for notmuch count
Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-15 19:22:13 -04:00
Austin Clements
ed20210b6d test: Add a test script for "notmuch tag" 2011-11-14 21:21:22 -04:00
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