Commit graph

336 commits

Author SHA1 Message Date
Austin Clements
bff30540d8 new: Wrap adding and removing messages in atomic sections.
This addresses atomicity of tag synchronization, the last atomicity
problems in notmuch new.  Each message add or remove is wrapped in its
own atomic section, so interrupting notmuch new doesn't lose progress.
2011-09-24 20:00:29 -03:00
David Bremner
73ed66a501 test: use test_expect_equal_file in atomicity
The documentation claims this is more robust, and it seems to work
fine to switch to the _file variant.
2011-09-13 09:31:46 -03:00
David Bremner
05a522c5fa test: Convert atomicity test to use test_subtest_known_broken
This is required because test_expect_equal_failure went away.
2011-09-13 09:28:08 -03: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
Austin Clements
003e718020 test: Report test failures from test_expect_*
This makes test_expect_* return non-zero if the test fails, so the
caller can make decisions based on this, such as setting test
prerequisites.
2011-09-12 23:36:00 -03:00
Austin Clements
5ae1b9c328 test: Fix message when skipping test_expect_equal* tests
For these types of tests, the test name is previously recorded in a
variable, not passed to the test function, so pass this variable to
test_skip.
2011-09-12 23:35:59 -03:00
David Bremner
22af786838 test: reset test_subtest_known_broken_ after each success/failure.
This means that test_subtest_known_broken needs to be called before
every known broken subtest, which is no different than what is
documented for the test_begin_subtest case.

The assumption is that every test ends up calling either skipping,
calling test_ok_ or test_failure_ and and the latter in turn delegate
to the known_broken versions in the case where
test_subtest_known_broken_ is set.
2011-09-12 23:35:21 -03:00
David Bremner
0a7aa617d5 test: mark multipart rfc822 part test as broken
Using the new test_subtest_known_broken support thanks to Dmitry
Kurochkin.  This makes the output less scary until we can fix the
underlying problems.
2011-09-10 15:00:17 -03:00
David Bremner
3ee541ab31 test: remove documentation for test_expect_equal_failure.
The actual function was deleted in commit 4cc67276
2011-09-10 14:54:56 -03:00
Dmitry Kurochkin
c6a3a768fe test: add emacs test for hiding a message following an HTML part
Human-friendly scenario:

* open a thread where a message which ends with an HTML part is
  followed by another message

* make the first message visible

* goto the beginning of the second message (first line, first colon)

* hit "RET"

Result: nothing happens except for "No URL at point" message

Expected result: the second message is shown/hidden

The root cause is that the HTML part has `keymap' text property set.
In particular, "RET" is bound to visit a URL at point.  The problem is
that `keymap' property affects the next character following the region
it is set to (see elisp manual [1]).  Hence, the first character of
the next message has a keymap inherited from the HTML part.

[1] http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html
2011-09-10 10:13:40 -03:00
Dmitry Kurochkin
4cc6727688 test: improve known broken tests support
There is existing support for broken tests.  But it is not convenient
to use.  The primary issue is that we have to maintain a set of
test_expect_*_failure functions which are equivalent to the normal
test_expect_* counterparts except for what functions are called for
result reporting.  The patch adds test_subtest_known_broken function
which marks a subset as broken, making the normal test_expect_*
functions behave as test_expect_*_failure.  All test_expect_*_failure
functions are removed.  Test_known_broken_failure_ is changed to
format details the same way as test_failure_ does.

Another benefit of this change is that the diff when a broken test is
fixed would be small and nice.

Documentation is updated accordingly.
2011-09-10 10:13:27 -03:00
Dmitry Kurochkin
0db3a4d5be test: update documentation for test_emacs in test/README
Update test_emacs documentation in test/README according to the latest
changes in emacs tests.  Move the note regarding setting variables
from test/emacs to test/README.
2011-09-10 10:12:03 -03:00
Jameson Graef Rollins
c8598d9a99 test: overhaul multipart test to test for improved message/rfc822 handling
The main goal of this overhaul is to define how message/rfc822 parts
should be handled.  message/rfc822 parts should be output in a similar
fashion to the outer message, including some subset of the rfc822
headers.  The following decisions about formatting of message/rfc822
parts were made:

The format and content of message/rfc822 parts shall be as similar as
possible to that of full messages.  In particular, for formatted
outputs, the "content" of rfc822 part output should include "headers"
and "body" fields).

The "body" field shall include the body of the message.

The "headers" field shall include the following headers, since these
are the ones available from the GMimeMessage:

  "From"
  "To"
  "Cc"
  "Subject"
  "Date"

However, for the case of --format=raw the raw rfc822 should be output,
including all headers.

A subset of relevant headers shall be output in reply.

The test embedded rfc822 message is also modified to be itself
multipart, so we can more fully test how all sub parts of the message
part are output.

Note added by Committer:

Currently, expect one test (--format=raw --part=3, rfc822 part) to fail.
2011-09-05 22:57:39 -03:00
Jameson Graef Rollins
ec2b0a98cc test: Fix date in test message in multipart test.
The test message date, "Tue, 05 Jan 2001 15:43:57 -0000", is not
actually a real date.  05 Jan 2001 was in fact a Friday, not a
Tuesday.  Date parsers (such as "date" in coreutils) will return "Fri"
as the day for this string, even if "Tue" is specified.

Also, the time zone "-0000" is actually always returned as "+0000", so
we change that here was well.

This will be relevant for later patches when we begin parsing rfc822
part headers, where gmime returns a parsed date string.

If we do want to test date parsing, we should do that in a separate
test.
2011-09-05 08:54:56 -03:00
Jameson Graef Rollins
ea3a26f590 test: some small fixes to multipart test
There were two "--format=text --part=0" tests.  One of them was
supposed to be a test for "--format=text --part=1".

There were also two errant "test_expect_equal_file OUTPUT EXPECTED"
lines, that are removed here.
2011-09-05 08:54:56 -03:00
Carl Worth
580de27177 emacs: Fix to unconditionally display subject changes in collapsed thread view
The feature to show subject changes in the collapsed thread view was
originally added (8ab433607) with an option
(notmuch-show-always-show-subject) to display the subject
for all messages, even when there was no change.

The subsequent commit (4f04d273) changed the sense of the test (or to
and) and the name of the controlling variable
(notmuch-show-elide-same-subject).

But this commit is broken in a few ways:

  1. The original definition of notmuch-show-always-show-subject was
     left around

     But the variable isn't actually used in the code at all, so it
     just adds clutter and confusion to the customization interface.

  2. The name and description of the controlling variable doesn't
     match the implementation

     The name suggests that setting the variable to t will cause
     repeated subjects to be elided, (suggesting that when it is nil
     all subjects will be shown).

     However, when the variable is nil, no subjects are shown. So a
     correct name for the variable in this sense would be
     notmuch-show-subject-changes.

Showing subject changes is a useful feature, and should be on by
default. (We don't want to bury generally useful features behind
customizations that users have to find).

Rather than fixing the name of the variable and changing its default
value, here we remove the condition entirely, such that the feature is
enabled unconditionally.

So both the currently-used variable and the stale definition of the
formerly-used are removed.

Also, the one relevant test-suite result is updated, (showing the
intial subject of a collapsed thread, and no subject display for later
messages that do not change the subject).
2011-07-01 02:00:25 -07:00
Jameson Graef Rollins
a31ad0bd01 test: document test_expect_equal_file
This test was not properly documented when it was originally added (my
bad).
2011-06-29 15:36:43 -07:00
Austin Clements
47afbdfb79 test: Nix increment_mtime.
With the fix for the mtime race, this workaround is no longer
necessary.
2011-06-29 15:26:45 -07:00
Pieter Praet
ec1b568929 test: revert non-intentional changes introduced in eb4cf465
eb4cf465 introduces changes which weren't part of the submitted
patch (id:"87liwlip2j.fsf@gmail.com"), presumably made during
resolving merge conflicts.

The first one causes the title of a test to be printed a second time,
in place of the correct title:

  PASS   Message with .. in Message-Id:
  PASS   Message with .. in Message-Id:

instead of:

  PASS   Message with .. in Message-Id:
  PASS   Sending a message via (fake) SMTP

The second one is simply the insertion of a line break, so no harm there.

This commit reverts both changes, as they were clearly accidental.

Signed-off-by: Pieter Praet <pieter@praet.org>
2011-06-29 14:20:57 -07:00
Carl Worth
55a78d5dbd test: Use increment_mtime rather than sleep
The sleep was to force the directory's mtime to advance between the
previous notmuch new and the subsequent rm;notmuch new.

The current convention is to use the existing increment_mtime function
for this purpose, (which avoids the test suite being slowed down by
calls to sleep).

Thanks to Austin Clements for noticing this undesired sleep.
2011-06-29 14:11:38 -07: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
Dmitry Kurochkin
f74c4bc2f3 test: fix tests after notmuch show output changes related to filenames
Adding the filename propery alongside ID and Content-type.

This makes the test suite pass again after the recent change.
2011-06-28 20:06:20 -07:00
Dmitry Kurochkin
a854d06e92 test: use emacsclient(1) for Emacs tests
Before the change, every Emacs test ran in a separate Emacs
instance.  Starting Emacs many times wastes considerable time and
it gets worse as the test suite grows.  The patch solves this by
using a single Emacs server and emacsclient(1) to run multiple
tests.  Emacs server is started on the first test_emacs call and
stopped when test_done is called.  We take care not to leave
orphan Emacs processes behind when test is terminated by whatever
reason: Emacs server runs a watchdog that periodically checks
that the test is still running.

Some tests need to provide user input.  Before the change, this
was done using echo(1) to Emacs stdin.  This no longer works and
instead `standard-input' variable is set accordingly to make
`read' return the appropriate string.
2011-06-28 17:10:55 -07:00
Carl Worth
6ea26cfb81 test: Increment mtime when delivering a message with emacs_deliver_message
Without this, mail messages delivered by emacs_deliver_message might
not be seen by the next invocation of "notmuch new", (which can lead
to test-suite failures if emacs_deliver_message is fast enough).
2011-06-28 17:10:55 -07:00
Mark Anderson
eb4cf465a5 test:Improve test behaviors when --root is used
Change add_email_corpus, emacs_deliver_message and tests to use
$TEST_DIRECTORY instead of '..'.

This improves the behavior of the usage of --root=<dir>, as the
assumption of what '..' means will usually be incorrect.

Document -root option in README and update valgrind to work with
-root.
2011-06-28 16:01:56 -07:00
Dmitry Kurochkin
273d896097 test: generate run_emacs script once on test startup
Instead of generating auxiliary run_emacs script every time
test_emacs is run, do it once in the beginning of the test.

Also, use absolute paths in the script to make it more robust.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
0cc5483a9c test: set variables using let' instead of setq' in Emacs tests
Using `setq' for setting variables in Emacs tests affect other
tests that may run in the same Emacs environment.  Currently it
works because each test is run in a separate Emacs instance.  But
in the future multiple tests will run in a single Emacs instance.
The patch changes all variables to use `let', so the scope of the
change is limited to a single test.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
0417c1fad6 test: use emacs_deliver_message in Emacs SMTP send test
Minor changes to expected results of other Emacs tests were
needed because the message Date header changed.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
5eb6b2767a test: remove some sed(1) calls in Emacs tests
Few Emacs tests used sed(1) to remove unexpected output in the
beginning to avoid getting confused by messages such as "Parsing
/home/cworth/.mailrc... done".  This is no longer needed since
tests are run in a temporary home directory instead of the user's
one.  So remove these sed(1) calls.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
3b24b396c4 test: save buffer content to file instead of printing it in Emacs tests
Before the change, the common Emacs test scheme was to print
buffer content to stdout and redirect it to a file or capture it
in a shell variable.  This does not work if we switch to using
emacsclient(1) for running the tests, because you can not print
to the stdout in this case. (Actually, you can print to stdout
from Emacs server, but you can not capture the output on
emacsclient(1)).

The patch introduces new Emacs test auxiliary functions:
`test-output' and `test-visible-output'.  These functions are
used to save buffer content to a file directly from Emacs.  For
most tests the changes are trivial, because Emacs stdout output
was redirected to a file anyway.  But some tests captured the
output in a shell variable and compare it with the expected
output using test_expect_equal.  These tests are changed to use
files and test_expect_equal_file instead.

Note: even if we do not switch Emacs tests to emacsclient(1), the
patch makes tests cleaner and is an improvement.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
caeb05493d test: wrap and indent test_emacs calls
Most test_emacs calls have long arguments that consist of many
expressions.  Putting them on a single line makes it hard to read
and produces poor diff when they are changed.  The patch puts
every expression in test_emacs calls on a separate line.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
dd75723921 test: cleanup test_emacs
Move auxiliary function definition and configuration from command
line to test-lib.el.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
5806c471de test: do not set `message-signature' in test_emacs
It is no longer needed since tests are run in a temporary home
directory instead of the user's one.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
e4fc21e88b test: fix argument order of test_expect_equal_file in few tests
Few Emacs tests had test_expect_equal_file arguments in the wrong
order: the first argument should be the test output and the
second one should be the expected.
2011-06-28 15:06:47 -07:00
Mark Anderson
c87da6961d test:Expect multiple filenames for message with multiple files
Update the test mail corpus to have two files with the same content to
expose the bug where a single message with multiple filenames only
reports a single filename.

Update expected results for search --output=files to match new
behavior for multiple files corresponding to a single message

Signed-off-by: Mark Anderson <ma.skies@gmail.com>
2011-06-28 12:05:50 -07:00
Dmitry Kurochkin
8bf0c1c3de test: remove useless test_emacs call from an emacs FCC test
This was inadvertently left over when debugging an early version of
this commit. -Carl Worth <cworth@cworth.org>
2011-06-23 17:11:04 -07:00
Pieter Praet
b4c9ee2809 fix sum moar typos [test-case data]
Various typo fixes in some test-case data.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
test-case data.
2011-06-23 15:59:11 -07:00
Pieter Praet
432e091924 fix sum moar typos [user-visible documentation in code]
Various typo fixes in documentation within the code that can be made
available to the user, (emacs function help strings, "notmuch help"
output, notmuch man page, etc.).

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
documentation and fixed fix of "comman" to "common" rather than
"command".
2011-06-23 15:58:50 -07:00
Pieter Praet
8bb6f7869c fix sum moar typos [comments in source code]
Various typo fixes in comments within the source code.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
source-code comments, (and fixed fix of "descriptios" to "descriptors"
rather than "descriptions").
2011-06-23 15:58:39 -07:00
Pieter Praet
730acd4764 fix sum moar typos [build scripts, Makefiles]
Various typo fixes in comments within the Makefile and other build scripts.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just build files.
2011-06-23 15:44:59 -07:00
Pieter Praet
18bf91def9 fix sum moar typos [text files]
Various typo fixes in auxiliary text files included with the source,
(README, TODO, etc.).

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just text files.
2011-06-23 15:40:50 -07:00
Carl Worth
76b54f1898 test: Test emacs message composing with various values for notmuch-fcc-dirs
We exercise each of the documented values (nil, a string, and a
list). For the list, we test matching a specific entry, matching a
catch-all regular expression, and no match at all (in which case there
is no FCC set).
2011-06-23 15:19:06 -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
Carl Worth
b0ba84f9e7 smtp-dummy: Prefer return rather than exit() in main.
The main() function should be written as just another function with a
return value. This allows for more reliable code reuse. Imagine that
main() grows too large and needs to be factored into multiple
functions. At that point, exit() is probably the wrong thing, yet can
also be hard to notice as it's in less-frequently-tested exceptional
cases.
2011-06-22 06:38:33 -07:00
Dmitry Kurochkin
41a094624a Fix compilation warnings in test/smtp-dummy.c.
* Remove unused variables in main(): buf, bytes and greeting.
* Replace return with no value in main() with exit(3).
2011-06-22 06:38:33 -07: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
Dmitry Kurochkin
59b251ef94 test emacs: Add tests for hiding messages in notmuch-show view
This test is expected to fail as it exposes a current bug, (which we
hope to fix soon).
2011-06-15 07:07:32 -07:00
Carl Worth
b7db7ea420 test: Fix from-guessing to actually span Received headers over multiple lines
The intent was always to make these Received headers span multiple
lines. But the escapes were causing the shell to ignore the newlines,
so that the result instead was long Received headers on a single line
each.

Fixing the intent here doesn't actually change the test-suite results
at all.
2011-06-10 17:20:22 -07:00
Carl Worth
ac43a96988 test: Extend from-guessing test with a test with multiple Received headers
This is much more realistic, as most messages in the wild will have multiple
Received headers. Also, this demonstrates a current bug in the Received
header parsing, (multiple Received headers are not properly concatenated
depending on the order in which headers are parsed in a message).
2011-06-10 17:03:14 -07:00
Carl Worth
d5edb1122d test: Add test that emacs detects and hides top-post quotes of original messages
This tests the recently-added detection/hiding of top-posted quotations and
in the testing, it takes advantage of the less-recently-added
visible-buffer-string function for emitting only the visible text
from a buffer.
2011-06-10 16:28:26 -07:00
Jameson Graef Rollins
61ff61cc2c test: modify multipart test to use test_expect_equal_file
Again, this is a much cleaner and more thorough test, and in fact
exposes a bug in the format=text output, that will be fixed the next
commit.  Because of this, some of the multipart tests currently fail.
2011-06-03 15:24:35 -07:00
Jameson Graef Rollins
5b0bf70faa test: update emacs test to use test_expect_equal_file
This is a much cleaner way to do the emacs tests, since we're actually
comparing output against existing files with expected output.  We also
won't miss any trailing newlines this way.

And speaking of which, one of the expected output files was actually
missing a trailing blank line that was actually in one of the original
messages, so this was fixed.
2011-06-03 14:29:05 -07:00
Dmitry Kurochkin
79a587d963 test: add "notmuch-show for message with invalid From" test 2011-06-03 14:07:19 -07:00
Austin Clements
c62a0d016f Fix misspelling in search output sanitization test.
A simple spelling fix in the text description.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-06-03 12:30:55 -07:00
Jameson Graef Rollins
c4e6d3291c test: cleanup search-output test names (no functional change)
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-06-01 21:59:42 -07:00
Florian Friesdorf
8dcd8b6987 test: add test for sanitized notmuch-search output
This feature was recently added, so it of course needs a test now.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>

Edited-by: Carl Worth <cworth@cworth.org> Fixed test to use
notmuch_search_sanitize in order to be robust against unpredictable
thread ID numbers, (due to unpredictable order in which the filesystem
presents files).
2011-06-01 21:58:16 -07:00
Florian Friesdorf
e584c64c5b test: Create and set temporary home directory
In the master branch in test/emacs two tests access the build users home
directory, so does emacs_deliver_message in the crypto branch.

The tests should not touch the build user's home directory. The patch
creates a directory in the temporary test directory and sets home
accordingly.

In case of a non-existent home directory, the tests are failing without
this patch.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-06-01 17:46:51 -07:00
Jameson Graef Rollins
afdfa5674c test: remove json test for search null result, since it's being more properly tested in search-output
The test in json was inferior to the one in search-output, since it
wasn't properly testing for the presence of a trailing newline.
2011-06-01 16:35:11 -07:00
Jameson Graef Rollins
7fdeb0fb63 test: move utf-8 subject search test from json to search test script
This test doesn't have anything to do with json, and has everything to
do with testing search capability, so I'm not sure why it was in the
wrong place.
2011-06-01 16:35:11 -07:00
Jameson Graef Rollins
7a453716c2 test: Move a test from search to search-output, and add a similar json test
The "Search for non-existent message prints nothing" test fits better
with the existing tests in search-output, so move it there. Also add a
similar test for the --format=json case.

These tests also use the new test_expect_equal_file function, (to ensure
that the presence of a trailing newline is correctly tested).
2011-06-01 16:31:52 -07:00
Jameson Graef Rollins
593d96ff1d test: modify search-output test to use the new test_expect_equal_file function
These test now properly test for the presence of a newline at the end
of all output.  Right now some of these test will fail because the
search output is currently broken to *not* produce proper newlines in
some cases.
2011-06-01 13:08:26 -07:00
Carl Worth
c6b49ae752 test: Add test showing notmuch corrupts a part with a CRLF pair in it
Since commit 2f8871df6e notmuch has been
using a function (show_part_content) originally written only for text
parts to save all MIME parts. The problem with this is that this
function converts CRLF pairs to LF only and optionally converts to
UTF-8 encoding. These two conversions have the potential to corrupt
binary data when passed through the function.

This test demonstrates that corruption, and so fails currently, until
we fix the bug.
2011-05-31 15:39:26 -07:00
Carl Worth
6ca7d73239 test: Fix a misspelling in one of our test cases.
Not that it affects the correctness of the test, but it's nice to use
proper spelling. This kind of change could invalidate a signature on the
test message, but I think that would have happened previously when the
HTML part was added in the first place.
2011-05-31 15:19:12 -07:00
Dmitry Kurochkin
5a7a1d4997 test: add test for saving attachments using notmuch-show-save-part
Use .gz filenames for saved attachments in the tests to check
that Emacs does not re-compress the file.

Use test_expect_equal_file instead of test_expect_equal to avoid
binary output on the console.
2011-05-31 15:10:27 -07:00
Dmitry Kurochkin
59a9c36316 test: copy files in test_expect_equal_file instead of moving them
Before the change, test_expect_equal_file moved files it compared
in case of failure.  The patch changes it to copy the files
instead.  This allows testing non-temporary files which are
stored in git.

Note: the change should not result in new temporary files left
after the tests.  Test_expect_equal_file used to move files only
on failure, so callers had to cleanup them anyway.
2011-05-31 15:10:23 -07:00
Jameson Graef Rollins
82daf29187 Render all parts of multipart/encrypted when decrypting.
The primary goal here is to keep the decrypted output as similarly
structured as undecrypted output as possible.  Now, when decrypting
parts, only the original encrypted part is replaced by the it's
decrypted content.  If this part isn't itself a multipart, then all
part numbering should remain consistent during decryption.

The only draw back here is that the useless application/pgp-encrypted
sub-part of the multipart/encrypted part is also emitted.  But this
part can be easily ignored by clients.
2011-05-27 16:22:00 -07:00
Jameson Graef Rollins
5404519749 Do not replace multipart/signed part with content part when doing verification.
Some folks have complained about the part renumbering that occurs when
the entire multipart/signed part is replaced with the part contents
after verification.  This is primarily because it incurs an additional
computational cost to retrieve individual parts, since verification
has to be performed again to ensure that part numbering is consistent.
This patch simply leaves the full multipart/signed part as is.

The emacs crypto test is also updated to reflect this change.
2011-05-27 16:22:00 -07:00
Jameson Graef Rollins
1d6b49561f tag signed/encrypted during notmuch new
This patch adds the tag "signed" to messages with any multipart/signed
parts, and the tag "encrypted" to messages with any
multipart/encrypted parts.  This only occurs when messages are indexed
during notmuch new, so a database rebuild is required to have old
messages tagged.
2011-05-27 16:22:00 -07: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
Jameson Graef Rollins
18967ef750 test: add notmuch_show_sanitize_all function that is a little more aggressive.
The old notmuch_show_sanitize function only scrubed part of the
filename.  This one scrubs the full filename, as well as the message
id.
2011-05-27 16:18:57 -07:00
Jameson Graef Rollins
b596fbbcd3 test: new test-lib function to test for equality between files
We need to be able to test for the presence of a newline at the end of
output.  There's no good way to capture trailing newlines in bash, so
redirecting output to a file is the next best thing.  This new
function should be used when testing for output that is expected to
have trailing newlines.

The next commit will demonstrate the use of this.
2011-05-27 16:18:57 -07:00
Dmitry Kurochkin
a0ebd5c5e4 test: use princ' instead of message' calls in emacs tests
The patch replaces all (message (buffer-string)) calls in emacs
tests with (princ (buffer-string)).  This avoids accidentally
interpreting '%' as format specifiers and makes code simpler
because we do not need to capture stderr.

Also, the patch works around an Emacs (23.3+1-1 on current Debian
Unstable) segfault in "Ensure that emacs doesn't drop results"
test.  Note: the segfault does not happen on every test run.
Though, it seems to be consistently reproducible if the test uses
300 messages instead of 30.  Hopefully, it is the crash described
in Emacs bug #8545 [1] which is already fixed.

[1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8545
2011-05-27 16:07:29 -07:00
Carl Worth
33cf04c6a5 Update some more recent tests to use /usr/bin/env to find bash
The recentl-applied patch had grown stale, so update the tests that had
been created since it was originally written.
2011-05-27 14:08:04 -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
Dmitry Kurochkin
5297b361d1 test: add test-lib.el file with `visible-buffer-string' function
The patch adds test-lib.el file for Emacs tests auxiliary stuff.
Currently, it implements two functions: `visible-buffer-string'
and `visible-buffer-substring'.  These are similar to standard
counterparts without "visible-" prefix but exclude invisible
text.  The functions are not used anywhere at the moment but
should be useful for testing hiding/showing in the Emacs
interface.

Edited-by: Carl Worth <cworth@cworth.org> Fixed "basic" test to ignore
new test-lib.el file.
2011-05-26 14:13:48 -07:00
Dmitry Kurochkin
31b7c04ae1 test: add test for hiding/showing signature in notmuch-show view 2011-05-24 15:30:45 -07:00
Dmitry Kurochkin
d32b8b1715 test: fix expected output for emacs tests after the wash button label changes 2011-05-24 15:28:44 -07:00
Carl Worth
e267f9a467 test: Expand multipart test to cover "notmuch reply" as well
This gives coverage for the segmentation fault in "notmuch reply" that
was just fixed with the previous commit.
2011-05-24 12:19:18 -07:00
Jameson Graef Rollins
916c2aa624 test: Expand multipart test to cover part output in all formats.
The example multipart message is made a bit more complicated by adding
a message/rfc822 message, and the all parts are output and tested in
all output formats.
2011-05-24 12:19:18 -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
Jameson Graef Rollins
8b9fc33d99 test: remove hard-coded paths from multipart test
Small oversite, easily corrected.
2011-05-20 11:32:47 -07:00
David Edmondson
0898cfad5e emacs: Show cleaner `From:' addresses in the summary line.
Remove double quotes and flatten "foo@bar.com <foo@bar.com>" to
"foo@bar.com".

Edited-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> (clean up
expected output for emacs tests).

Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
2011-05-18 16:11:53 -07:00
Carl Worth
22443de789 test: Link to compat files when building program during "make test"
The compilation of the smtp-dummy program would fail if a build was
attempted on a system without getline. Fix this by simply including
the existing notmuch_compat_srcs variable when constructing the list
of source files for compiling smtp-dummy.
2011-05-18 13:15:46 -07:00
Carl Worth
362ab047c2 notmuch show: Properly nest MIME parts within mulipart parts
Previously, notmuch show flattened all output, losing information
about the nesting of the MIME hierarchy. Now, the output is properly
nested, (both in the --format=text and --format=json output), so that
clients can analyze the original MIME structure.

Internally, this required splitting the final closing delimiter out of
the various show_part functions and putting it into a new
show_part_end function instead. Also, the show_part function now
accepts a new "first" argument that is set not only for the first MIME
part of a message, but also for each first MIME part within a series
of multipart parts. This "first" argument controls the omission of a
preceding comma when printing a part (for json).

Many thanks to David Edmondson <dme@dme.org> for originally
identifying the lack of nesting in the json output and submitting an
early implementation of this feature. Thanks as well to Jameson Graef
Rollins <jrollins@finestructure.net> for carefully shepherding David's
patches through a remarkably long review process, patiently explaining
them, and providing a cleaned up series that led to this final
implementation. Jameson also provided the new emacs code here.
2011-05-17 15:58:57 -07:00
Carl Worth
c51d5b3cdb notmuch show: Include output for the enclosing multipart part of a MIME mail
Previously, the outer multipart part of any multipart/mixed,
multipart/signed, etc. MIME message was silently omitted from the
"notmuch show" output. This prevented any client from correctly
determining to which parts a signature applies, for example.

Now, we actually emit these parts as their own parts. The output is
still flattened---the contained parts are not yet included "within"
the multipart part---so it's still not possible to determine to which
parts a signature applies, but this is one step along the path.

The test suite is updated to reflect this change, (though we'll
eventually want to fix the emacs interface to not display buttons for
the multipart enclosure parts as there's nothing useful for the user
to actually do with them).
2011-05-17 14:51:06 -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
d313bfb59b test: Mark the search-insufficient-from-quoting tests to expect success
Theses were expected failures only due to a bug in GMime (with
versions of GMime before 2.4.18). As of GMime version 2.4.18 this bug
is fixed and these tests now pass.
2011-04-25 15:16:49 -07:00
Carl Worth
708c4f46ca emacs: Don't drop error messages from "notmuch search"
With the previous commit, unexpected output before or between search results
would be displayed. However, trailing junk from the "notmuch search" output
would still be silently swallowed.

The most common case for an error message from "notmuch search" would be
an invalid command-line, and in that case, there would be no search results
and the trailing error message would get swallowed.

We fix the process sentinel to check for leftover data and add it to the
final buffer. We also add a test case to ensure this works.
2011-03-10 16:53:46 -08:00
Carl Worth
44d3c57e2a emacs: Display any unexpected output from notmuch search
Rather than silently swallowing unexpected output, the emacs interface will now
display it. This will allow error messages to actually arrive at the emacs
interface (though not in an especially pretty way). This also allows for easier
investigation of the inadvertent swallowing of search results that span page
boundaries (as demonstrated by the recent added emacs-large-search-buffer test).

The page-boundary bug has been present since a commit from 2009-11-24:
93af7b5745

Many thanks to Thomas Schwinge for tracking that bug down and
contributing the test for it.
2011-03-10 15:18:40 -08: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
0b1ddc5f66 json: Fix search result with no matches to be a valid json object.
In the original json code, search matching nothing would return a
valid, empty json array (that is, "[]"). I broke this in commit
6dcb7592e3 when adding support for
--output=threads|messages|tags. This time, while fixing the bug also
add a test to the test suite to help avoid future regressions.
2011-03-09 15:10:03 -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
Thomas Schwinge
12f4443e23 Add a few tests for searching LWN emails.
These tests should pass -- but they currently don't.

Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
2011-03-09 15:10:03 -08:00
Thomas Schwinge
21e97c50d4 Clarify usage of `additional_headers' in test/test-lib.sh:generate_message.
Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
2011-01-28 15:19:19 +10: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
ac1ba43666 Fix misspelling in a comment.
Just a simple change I noticed in passing.
2011-01-15 15:37:43 -08:00
Carl Worth
8a8d0b7395 test/basic: Ignore new files ending in ~
We don't need to complain that temporary editor backups are not added
to the list of tests to be run.
2011-01-15 15:37:43 -08:00
Carl Worth
e255654232 Update test suite for 7 tests that were recently fixed.
These tests had been broken, but were fixed by the preceding commit,
so update the test suite to print PASS rather than FIXED for these.
2010-12-07 16:35:47 -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
b41aab78f2 test: Leave tmp.<testname> for broken tests
Previously, this directory was only preserved for failing tests. But
it's important to be able to easily debug known-broken tests, so
preserve the actual vs. expected output for those as well.
2010-12-07 16:23:20 -08:00
Austin Clements
a18a15326c Make author order tests more strict.
Use varying dates in the test messages to test the order authors are
listed in.  Add tests with repeated author names and unusual date
ordering.  Most of these are broken at the moment, but will be fixed
shortly.

Edited-by: Carl Worth <cworth@cworth.org>: Also update the expected
results for existing emacs tests that currently codify the incorrect
author ordering, (and similarly note them as broken in the current
test suite).
2010-12-07 16:21:35 -08:00
Austin Clements
04d633c285 Fix handling of broken tests.
Make sure to close the subtest for test_expect_equal_failure, just
like in test_expect_equal.
2010-12-07 16:21:23 -08:00
David Edmondson
5d05d5434d emacs: Improve the display of truncated authors.
Incremental search does not match strings that span a
visible/invisible boundary. This results in failure to correctly
isearch for authors in `notmuch-search' mode if the name of the author
is split between the visible and invisible components of the authors
string. To avoid this, attempt to truncate the visible component of
the authors string on a boundary between authors, such that the
entirety of an author's name is either visible or invisible.
2010-12-07 13:57:05 -08:00
David Edmondson
2ff4c4bb2a test: Ignore files created during test failures.
When a test fails, a tmp.<testname> file is left behind. These files
are useful for the person debugging the test failure, but are never
anything we want to commit.

Edited-by: Carl Worth <cworth@cworth.org>: Changed from tmp.emacs to
tmp.* and added explanation in the commit message.
2010-12-07 13:47:44 -08:00
Carl Worth
9e0d00f37e test: Add --format=json testing to the "notmuch search --format" tests.
This testing *does* capture the bug of missing '[' and ']' characters
int "notmuch search --output=tags" case. This is another manifestation
of the same bug causing the missing final newline (as mentioned in the
previous commit).
2010-11-23 17:54:47 -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
Carl Worth
2742663072 test: Don't print a test result for preliminary test setup
This test script does some initial test setup (generating a few
messages), which is all well and good, but we don't need to print that
as a test result---particularly since the test result was effectively
hard-coded to always pass.
2010-11-16 11:29:47 -08:00
Michal Sojka
24d42f0507 test: Fix bugs detected thanks to the previous commit 2010-11-16 11:28:06 -08:00
Michal Sojka
556986511c test: Detect unfinished subsets
When test_begin_subtest is not followed by corresponding test_expect_equal,
the output of the rest of the test script is errornously suppressed. Add
code to detect these bugs in test scripts.
2010-11-16 11:28:06 -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
c8d51e2912 test: Add trailing newline to error messages
The newline was removed from say_color in commit 222926ab to allow
printing test status in the beginning of the line. Error messages are
never followed by other text so we add the newline to error function.
2010-11-16 11:28:06 -08:00
Michal Sojka
ac9dbb47de test: Better handling of stdout and stderr
Git-style tests (test_expect_success etc.) suppress stdout and stderr
unless -v is given. Notmuch-style tests (created by test_begin_subtest
and test_expect_equal) do not have this behavior so implement it the
same.

Additionally, for both test styles, the test-lib.sh is changed so that
the content of suppressed stdout and stderr is shown in case of failed
test.

Finally a test for this functionality is added to basic tests.
2010-11-16 11:28:06 -08:00
Carl Worth
42f1a13374 test: Update emacs tests for fix to counting of signature lines.
The recent bug fix invalidated some expected test results. Fix them up.
2010-11-11 17:00:15 -08:00
Carl Worth
96d99c3837 tags_to_maildir_flags: Fix to preserve existing, unsupported flags
This is to prevent notmuch from destroying any information the user
has encoded as flags in the maildir filename. Tests are also added to
the test suite to verify the documented behavior.
2010-11-11 16:36:02 -08:00
Carl Worth
95dd5fe5d7 notmuch_message_tags_to_maildir_flags: Do nothing outside of "new" and "cur"
Some people use notmuch with non-maildir files, (for example, email
messages in MH format, or else cool things like using sluk[*] to suck
down feeds into a format that notmuch can index).

To better support uses like that, don't do any renaming for files that
are not in a directory named either "new" or "cur".

[*] https://github.com/krl/sluk/
2010-11-11 14:32:17 -08:00
Carl Worth
f6ec7ca78f test: Move corpus emails into maildir directory structure
Now that we have maildir synchronization turned on by default, it's
advantageous to make all of the tests exercise it as much as possible.
2010-11-11 04:17:29 -08:00
Carl Worth
666e410b60 test: Fix emacs FCC test to account for new maildir synchronization
The FCC code saves a message in maildir format, and sets the S flag by
default, so now, automatically, FCC messages will not show up as
"unread", (which seems natural enough).
2010-11-11 04:12:43 -08:00
Carl Worth
28708d2bd3 Enable maildir synchronization by default.
This is a useful feature that most people should want, so enable it by
default, (still allowing customization to disable it of course).
2010-11-11 04:11:21 -08:00
Carl Worth
483f422699 test: Drop test for propagating flag changes from one file to another
There's nothing in the current API documentation that would suggest
the behavior being tested here. Attempt to implement this could have
some nasty side effects, (such as notmuch_message_maildir_flags_to_tags
implicitly calling notmuch_message_tags_to_maildir_flags and maybe
even opening up some bad looping possibilities).

Much better to stick with what we have documented, which we believe will
actually be useful, (and easy enough to comprehend).
2010-11-11 03:47:11 -08:00
Carl Worth
0100df8edb test: Add a new test that removal of a maildir flag also changes tags
This test exposes an existing bug, so is currently failing.
2010-11-11 03:40:19 -08:00
Carl Worth
0b6349d705 test: Rework recently-added additional maildir-sync tests
These needed to be changed to be brought up to the current state of
the maildir-sync tests. This includes style changes, but also the
elimination of any assumption about pre-existing message filenames,
(such as msg-003) which actually don't exist anymore.

Also, the known broken tests are changed to emit FAIL rather than
BROKEN simply to make them easier to fix, (so that they print the
current problems rather than hiding them).

Finally, an additional test is added to ensure that when a duplicate
file is added without flags, it doesn't invalidate flags from other
duplicates, (instead the flags are effectively merged).
2010-11-11 03:40:19 -08:00
Michal Sojka
2638fb7565 test: More maildir synchronization tests
Add maildir synchronization tests for multiple messages with the same
message-id. As this is not yet implemented in notmuch, some of these
teste are marked as BROKEN.

I use $(< ) operator to avoid fiddling with stripped trailing newlines
from test results which happens when output+=$(command) is used.
2010-11-11 02:35:03 -08:00
Carl Worth
882b994c17 test: Rework testing of maildir-synchronization feature.
This change reworks these tests in several ways:

1. Bring tests into "new" test style preferring test_expect_equal over
   test_expect_success in almost all cases.

2. Don't emit test results for intermediate items not actually being
   tested, (things like "no new messages", "search for message",
   etc.). Those things are already covered by existing tests such as
   "basic" or "search" and only serve to obscure what's actually being
   tested.

3. Change sense of the test showing failure to rename a file from
   "new" to "cur" when "cur" doesn't exist.

   In this case, notmuch should detect that this is not a maildir and
   should not attempt to do any renaming of the file.

4. Extend dump/restore test to also exercise addition of tag, not just
   removal.

Both items #3 and #4 above show shortcomings in the current
implementation. These are currently resulting in test results of FAIL
and indicate bugs that need to be fixed.
2010-11-11 02:35:03 -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
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