Commit graph

771 commits

Author SHA1 Message Date
Austin Clements
b3dc31f78d test: Test show's handling of subprocess errors 2012-12-16 17:04:24 -04:00
Pieter Praet
e7bd40aa4c test: emacs: new tests "notmuch-show: {add,remove} multiple tags {to,from} single message"
* test/emacs:

  - Rename subtests "{Add,Remove} tag from notmuch-show view" to
    "notmuch-show: {add,remove} single tag {to,from} single message"
    to be consistent with the following tests.

  - New subtest "notmuch-show: add multiple tags to single message":
    `notmuch-show-add-tag' ("+") can add multiple tags to a message.

  - New subtest "notmuch-show: remove multiple tags from single message":
    `notmuch-show-remove-tag' ("-") can remove multiple tags from a message.
2012-12-11 10:01:40 -04:00
David Bremner
0f066ece0f test/dump-restore: add test for warning/error messages
We want to test both that error/warning messages are generated when
they should be, and not generated when they should not be. This varies
between restore and batch tagging.
2012-12-09 13:33:34 -04:00
David Bremner
f9878f9173 test: second set of dump/restore --format=batch-tag tests
These one need the completed functionality in notmuch-restore. Fairly
exotic tags are tested, but no weird message id's.

We test each possible input to autodetection, both explicit (with
--format=auto) and implicit (without --format).
2012-12-09 13:33:34 -04:00
David Bremner
452f8748c4 test: update dump-restore roundtripping test for batch-tag format
Now we can actually round trip these crazy tags and and message ids.
hex-xcode is no longer needed as it's built in.
2012-12-09 13:33:34 -04:00
David Bremner
10085656d5 test: add sanity check for dump --format=batch-tag.
It's important this does not rely on restore, since it hasn't been
written yet.
2012-12-08 10:40:55 -04:00
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
Jani Nikula
540a34d096 test: use perl instead of sed -r for portability
Our OS X users report -r is not a supported option for sed. Use perl
instead.
2012-12-08 09:19:34 -04:00
Jani Nikula
60e79e3a9f test: wrap 'wc -l' results in arithmetic evaluation to strip whitespace
This is for portability, as 'wc -l' emits whitespace on some BSD
variants. Suggested by Tomi Ollila <tomi.ollila@iki.fi>.
2012-12-08 09:19:34 -04:00
Jani Nikula
423e4fbfeb test: fix count test
The quoting for ${SEARCH} is broken when it's supposed to be '*', and
it seems tricky to get it right. Just drop the variable and use '*'
directly. Before this, none of the messages ever matched, and the test
was comparing zeros.
2012-12-08 09:19:34 -04:00
Austin Clements
21326a1e6b test: Fix UTF-8 JSON tests in Python 3
test_expect_equal_json uses json.tool from the system Python.  While
Python 2 wasn't picky about the encoding of stdin, Python 3 decodes
stdin strictly according to the environment.  Since we set LC_ALL=C
for the tests, Python 3's json.tool was assuming stdin would be in
ASCII and aborting when it couldn't decode the UTF-8 characters from
some of the JSON tests.  This patch sets the PYTHONIOENCODING
environment variable to utf-8 when invoking json.tool to override
Python's default encoding choice.
2012-12-08 09:19:34 -04:00
Peter Feigl
2bd922ff06 Changing build tool for test/random-corpus to CXX instead of CC.
Without this change, GCC complains as follows:
gcc  test/random-corpus.o test/database-test.o notmuch-config.o command-line-arguments.o lib/libnotmuch.a util/libutil.a parse-time-string/libparse-time-string.a -o test/random-corpus -lgmime-2.6 -lgio-2.0 -lgobject-2.0 -lglib-2.0   -Wl,-rpath,/usr/lib -ltalloc   -lxapian
/usr/bin/ld: lib/libnotmuch.a(database.o): undefined reference to symbol '_ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4'
/usr/bin/ld: note: '_ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4' is defined in DSO /usr/lib/libstdc++.so.6 so try adding it to the linker command line
/usr/lib/libstdc++.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [test/random-corpus] Error 1
2012-12-06 17:14:36 -04:00
Peter Feigl
0f123ab3aa Adding parse-time to test/.gitignore
test/parse-time is a binary that is generated when running make test. It should be ignored by git.
2012-12-06 17:14:24 -04:00
Jani Nikula
7f54db1f04 test: fix an evident copy-paste error in argument parsing test 2012-12-04 09:07:32 -04:00
David Bremner
953c3fa853 test: add broken roundtrip test
We demonstrate the current notmuch restore parser being confused by
message-id's and tags containing non alpha numeric characters
(particularly space and parentheses are problematic because they are
not escaped by notmuch dump).

We save the files as hex escaped on disk so that terminal emulators
will not get confused if the test fails (as we mostly expect it to do).
2012-12-02 19:09:01 -04:00
David Bremner
76fa93e2a2 test: add generator for random "stub" messages
Initial use case is testing dump and restore, so we only have
message-ids and tags.

The message ID's are nothing like RFC compliant, but it doesn't seem
any harder to roundtrip random UTF-8 strings than RFC-compliant ones.

Tags are UTF-8, even though notmuch is in principle more generous than
that.

updated for id:m2wr04ocro.fsf@guru.guru-group.fi

- talk about Unicode value rather some specific encoding
- call talloc_realloc less times
2012-12-02 15:51:32 -04:00
David Bremner
990e3988ce test: add database routines for testing
Initially, provide a way to create "stub" messages in the notmuch
database without corresponding files.  This is essentially cut and
paste from lib/database.cc. This is a seperate file since we don't
want to export these symbols from libnotmuch or bloat the library with
non-exported code.
2012-12-02 15:51:32 -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
David Bremner
4216e830e9 test/hex-xcode: new test binary
This program is used both as a test-bed/unit-tester for
../util/hex-escape.c, and also as a utility in future tests of dump
and restore.
2012-12-02 09:14:59 -04:00
Austin Clements
8271272b54 test: Don't print 'nil' at the beginning of emacs-subject-to-filename 2012-11-29 09:24:12 -04:00
Austin Clements
7a0813b72a test: Use associative arrays to track external prereqs
Previously, the test framework generated a variable name for each
external prereq as a poor man's associative array.  Unfortunately,
prereqs names may not be legal variable names, leading to
unintelligible bash errors like
  test_missing_external_prereq_emacsclient.emacs24_=t: command not found

Using proper associative arrays to track prereqs, in addition to being
much cleaner than generating variable names and using grep to
carefully construct unique string lists, removes restrictions on
prereq names.
2012-11-29 09:24:12 -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
Austin Clements
d59d9c8152 test: Make the emacsclient binary user-configurable
And require that if TEST_EMACS is specified, so is TEST_EMACSCLIENT.

Previously, the test framework always used "emacsclient", even if the
Emacs in use was overridden by TEST_EMACS.  This causes problems if
both Emacs 23 and Emacs 24 are installed, the Emacs 23 emacsclient is
the system default, but TEST_EMACS is set to emacs24.  Specifically,
with an Emacs 24 server and an Emacs 23 client, emacs tests that run
very quickly may produce no output from emacsclient, causing the test
to fail.

The Emacs server uses a very simple line-oriented protocol in which
the client sends a request to evaluate an expression and the server
sends a request to print the result of evaluation.  Prior to Emacs bzr
commit 107565 on March 11th, 2012 (released in Emacs 24.1), if
multiple commands were sent to the emacsclient between when it sent
the evaluation command and when it entered its receive loop, it would
only process the first response command, ignoring the rest of the
received buffer.  This wasn't a problem with the Emacs 23 server
because it sent only the command to print the evaluation result.
However, the Emacs 24 server first sends an unprompted command
specifying the PID of the Emacs server, then processes the evaluation
request, then sends the command to print the result.  If the
evaluation is fast enough, it can send both of these commands before
emacsclient enters the receive loop.  Hence, if an Emacs 24 server is
used with an Emacs 23 emacsclient, it may miss the response printing
command, ultimately causing intermittent notmuch test failures.
2012-11-29 09:24:12 -04:00
Austin Clements
dba1f6e432 test: Quote $output in calls to test_expect_equal
Previously, many tests in emacs-subject-to-filename didn't quote the
$output argument to test_expect_equal.  As a result, if $output was
empty, test_expect_equal would be passed only one argument and would
abort the entire test script.  By quoting the argument, we ensure
test_expect_equal will always receive two arguments.
2012-11-27 10:25:41 -04:00
Austin Clements
7611a72be2 new: Skip ignored broken symlinks
We now test for user ignore patterns before attempting to determine if
a directory entry is itself a directory.  As a result, we no longer
abort for broken symlinks if the user has explicitly ignored them.

This fixes the test added in the previous patch.  It also slightly
changes the debug output checked by another test of ignores.
2012-11-26 22:17:20 -04:00
Austin Clements
f5d65615bb test: Add a test for skipping ignored broken symlinks
Currently marked as broken because we abort on broken symlinks, even
if they are in the ignore list.
2012-11-26 22:12:21 -04:00
Tomi Ollila
59c994e770 emacs: less guessing of character set in messages
The macro with-current-notmuch-show-message executes command
`notmuch show --format=raw id:...` which just outputs the contents
of the mail file verbatim (into temporary buffer). In case e.g. utf-8
locale is used the temporary buffer has buffer-file-coding-system as
utf-8. In this case Emacs converts the data to multibyte format, guessing
that input is in utf-8.
However, the "raw" (MIME) message may contain octet data in any other
8bit format, and as no (MIME-)content spesific handling to the message
is done at this point, conversion to other formats may lose information.
By setting coding-system-for-read 'no-conversion drops the conversion part
and makes this handle input as notmuch-get-bodypart-internal() does.
This marks the broken test in previous change fixed.
2012-11-26 22:06:41 -04:00
Tomi Ollila
0c4dea4e48 test/emacs: test saving of attachment containing 8bit octets
This test catches the case 8bit octets in an attachment gets converted
or lost when saving attachment to the file.
This test is marked known broken.
2012-11-26 21:58:15 -04:00
Austin Clements
610f0e0992 lib: Reject multi-message mboxes and deprecate single-message mbox
Previously, we would treat multi-message mboxes as one giant email,
which, besides the obvious incorrect indexing, often led to
out-of-memory errors for archival mboxes.  Now we explicitly reject
multi-message mboxes.  For historical reasons, we retain support for
single-message mboxes, but official deprecate this behavior.
2012-11-26 21:12:10 -04:00
Austin Clements
079f5a138b test: Test for ignoring multi-message mbox
This test is currently broken.  Note that its brokenness cascades and
causes the next test to fail as well (because notmuch incorrectly
indexes the mbox file).
2012-11-26 21:10:11 -04:00
Austin Clements
de9875ca83 test: Test notmuch new for single-message mbox
We support this for historical reasons.
2012-11-26 21:05:15 -04:00
David Bremner
20b7e0ff2f test: factor out part of test-lib.sh into test-lib-common.sh
The idea is to use some of the simpler parts of the test suite
infrastructure to help run performance tests.
2012-11-25 21:11:59 -04:00
Tomi Ollila
3bd8494da0 test: always source test-lib.sh as ./test-lib.sh
There are currently 45 TESTS scripts. 36 of those load
test-lib.sh using '. ./test-lib.sh' and 9 '. test-lib.sh'.

In latter case test-lib.sh is first searched from directories
in PATH (posix) and then from current directory (bash feature).

Changed the 9 files to execute '. ./test-lib.sh'. The test-lib.sh
should never be loaded from directory in PATH.
2012-11-24 22:07:46 -04:00
Austin Clements
73a9fcf89b test: Produce useful output when the HTML with images test fails
Previously, this would simply indicate that the grep failed without
any indication of the Emacs output it failed on.  Now we take
advantage of the test framework's handling of stdout to display the
incorrect Emacs output if the test fails.
2012-11-21 18:52:23 -04:00
David Bremner
be66f3f709 test: add nontrivial test for restore --accumulate.
It seems we have never tested the case that restore --accumulate
actually adds tags. I noticed this when I started optimizing and no
tests failed.

The bracketing with "restore --input=dump.expected" are to make sure
we start in a known state, and we leave the database in a known state
for the next test.
2012-11-17 10:24:24 -04:00
David Bremner
7d1a2ca0ce test: add more informative titles to restore --accumulate tests
Thanks to Ethan for the suggestion.
2012-11-17 10:18:00 -04:00
Tomi Ollila
3977b250cd Fixed 2 misspellings of word 'separate'
"Seperate: The second most common misspelling on the Internet..."
(from http://www.re-vision.com/spelling/separate.html).

s/seperate/separate/ in debian/NEWS.Debian & test/README done.
2012-11-16 15:50:55 -04:00
Austin Clements
3ac76816c5 test: Fix HTML rendering test
The test designed to exercise Emacs' rendering of HTML emails
containing images inadvertently assumed w3m was available under Emacs
23.  The real point of this test was to check that Emacs 24's shr
renderer didn't crash when given img tags, so use shr if it's
available, html2text otherwise (which is built in), and do only a
simple sanity check of the result.
2012-11-15 18:15:10 -04:00
Austin Clements
87a05adba3 emacs: Buttonize mid: links
This adds support for RFC 2392 mid: message ID links.
2012-11-15 18:13:27 -04:00
Austin Clements
580997252f emacs: Improve the regexp used to match id:'s in messages
This regexp agrees with Xapian query syntax much more closely, though
we specifically disallow various cases that would be confusing in the
context of an email body (e.g., punctuation at the end of an id: link
is not considered part of the id: link because it's probably part of
the surrounding text).

In particular, this handles id: links that are not surrounded by
quotes much better, which stash is much more likely to generate now
that we don't quote id's that don't need to be quoted.  It also
handles quoted id: links better.

We update the buttonization test to reflect the new pattern.
2012-11-15 18:11:07 -04:00
Austin Clements
65801835ee test: Test buttonization of id: links
This matches the current behavior of the buttonizer, so it passes, but
many of these cases are not what you'd want (and some of them aren't
even valid Xapian queries).  The next patch will fix the handling of
these cases and update the test.
2012-11-15 18:03:02 -04:00
David Bremner
b173037398 test: expand regex in test/basic
Over time, maintaining this very long regex has become irritating,
especially when resolving conflicts.

This patch replaces the call to sed with multiple extra arguments to
find.  Since each test binary is now on it's own line, this should
make resolving conflicts easier.
2012-11-10 16:47:10 -04:00
Peter Wang
96864a9aea test: add test for showing Reply-To headers
Test that show --format=json now outputs Reply-To header fields when
present.
2012-11-07 08:03:46 -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
Jani Nikula
519be19250 test: add new test tool parse-time for date/time parser
Add a smoke testing tool to support testing the date/time parser
module directly and independent of the rest of notmuch.

Credits to Michal Sojka <sojkam1@fel.cvut.cz> for the stdin parsing
idea and consequent massive improvement in testability.
2012-10-31 16:44:55 -03:00
Austin Clements
1a4cb8fd29 emacs: Introduce generic boolean term escaping function
Currently, we only properly escape stashed id queries, but there are
other places where the Emacs UI constructs queries for boolean terms.
Since this escaping function is meant to be used in other places, it
avoids escaping strings that don't need escaping.
2012-10-27 09:33:55 -03:00
Austin Clements
e0a223d156 tag: Disallow adding malformed tags to messages
This disallows adding empty tags, since nothing but confusion follows
in their wake, and disallows adding tags that begin with "-" because
they are also confusing, the tag "-" is impossible to remove using the
CLI, and because the syntax for removing such tags conflicts with long
argument syntax.

This does not place any restrictions on what tags can be removed, as
that would make it difficult for people who have the misfortune of
already having malformed tags to remove these tags.
2012-10-27 09:32:44 -03:00
Michal Nazarewicz
ffb629cc5d notmuch-show: include Bcc header in json output
With this change, emacs users can use notmuch-message-headers
variable to configure notmuch-show display Bcc header.
2012-10-22 20:06:21 -03:00
Ethan Glasser-Camp
0d552ab6d0 test: new: Fix intermittent test failures with --debug
Although messages are created in a particular order, it seems that
when they are created on a tmpfs, they do not always come back in the
same order, leading to the same files being ignored but being output
in a different order. This causes the test to fail because the outputs
being compared are the same.

Fix the failures by sorting the output of notmuch --debug and
comparing this to a hand-sorted version of its output.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
2012-10-22 20:04:15 -03:00
Tomi Ollila
b7f7b573e4 test/test-lib.sh: take the --background feature in smtp-dummy into use
The use of --background option (instead of shell '&') ensures that
smtp-dummy is listening its server socket until execution of shell
script can continue, thus the client will always have socket where
to connect.

smtp-dummy outputs smtp_dummy_pid variable in shell assignment format;
eval'ing that output makes that variable available for the shell.

As the smtp-dummy instance is no longer child process of the script
the SIGKILL signal sent to it will ensure it is going away in case
the mail sender fails to connect to smtp-dummy.
2012-10-20 17:46:11 -03:00
Tomi Ollila
d894887c94 test/smtp-dummy: add --background option and functionality
When shell executes background process using '&' the scheduling of
that new process is arbitrary. It could be that smtp-dummy doesn't
get execution time to listen() it's server socket until some other
process attempts to connect() to it. The --background option in
smtp-dummy makes it to go background *after* it started to listen
its server socket.

When --background option is used, the line "smtp_dummy_pid='<pid>'"
is printed to stdout from where shell can eval it.
2012-10-20 17:45:52 -03:00
Pieter Praet
1a4aa69492 test: another test wrt ignoring user-specified files and directories
Demonstrates that *every* file/directory which matches one of the values
in 'new.ignore' will be ignored, independent of its depth/location in
the mail store.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
2012-10-20 17:29:00 -03:00
Pieter Praet
f96ddb15f8 test-lib.sh: pass 'NOTMUCH_NEW's args down to 'notmuch new'
Obviates the need to create a 'NOTMUCH_NEW' clone which runs
'notmuch new --debug'.  This will be used in a later patch.

Doesn't cause any issues for other tests.
2012-10-20 17:28:34 -03:00
Pieter Praet
0db6c7b8be emacs: rename notmuch-show-toggle-headers' to notmuch-show-toggle-visibility-headers'
* emacs/notmuch-show.el

  (notmuch-show-toggle-headers):
    Rename to `notmuch-show-toggle-visibility-headers'.

  (notmuch-show-mode-map):
    Update "h" binding wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers):
    Update docstring wrt renamed `notmuch-show-toggle-headers'.

  (notmuch-message-headers-visible):
    Update docstring wrt renamed `notmuch-show-toggle-headers'.
    Also fixed a small typo.

* test/emacs:

  Update subtest wrt renamed `notmuch-show-toggle-headers':
  - "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)"
2012-10-20 12:10:41 -03:00
Pieter Praet
f5aa5ac6c7 test: emacs: new tests "notmuch-show: {, un}collapse all messages in thread"
* test/emacs:

  - New subtest "notmuch-show: collapse all messages in thread":
    `notmuch-show-open-or-close-all' with prefix arg ("C-u M-RET")
    collapses all messages in thread.

  - New subtest "notmuch-show: uncollapse all messages in thread":
    `notmuch-show-open-or-close-all' without prefix arg ("M-RET")
    uncollapses all messages in thread.
2012-10-20 12:10:24 -03:00
Pieter Praet
3a8712e7db test: emacs: new tests "notmuch-show: {show, hide} message headers"
* test/emacs:

  - New subtest "notmuch-show: show message headers":
    Setting `notmuch-message-headers-visible' to t causes all headers
    defined in `notmuch-message-headers' to be shown.

  - New subtest "notmuch-show: hide message headers":
    Setting `notmuch-message-headers-visible' to nil causes all headers
    defined in `notmuch-message-headers' to be hidden.
    ("Subject:" may be an exception;  See the use of `headers-start' in
    `notmuch-show-insert-msg')

  - New subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)":
    Setting `notmuch-message-headers-visible' to t causes all headers
    defined in `notmuch-message-headers' to be shown, but they can be
    hidden for the current message by running `notmuch-show-toggle-headers'.
2012-10-20 12:10:12 -03:00
Ethan Glasser-Camp
518eed1ba7 test: Move tests from emacs to emacs-show
This requires changing the contents of the crypto tests, as one thread
that was marked read by the earlier tests in test/emacs is no longer
marked read.

This moves tests for:

- 09d19ac "test: emacs: toggle eliding of non-matching messages in
   `notmuch-show'", which should have actually read: "test: emacs:
   toggle processing of cryptographic MIME parts in `notmuch-show'".
   See commit 19ec74c5.

- 5ea1dbe "test: emacs: toggle eliding of non-matching messages in
  `notmuch-show'"

- 345faab "test: emacs: toggle thread content indentation in
  `notmuch-show'"

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
2012-10-18 08:45:16 -03:00
Ethan Glasser-Camp
b52ee879d8 test: handle filenames that have directories in them
Since $TEST_DIRECTORY is an absolute path, any filenames generated
with it will be complete paths. Only use the basename to generate
suffixes for filenames.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
2012-10-18 08:44:37 -03:00
Pieter Praet
345faab1f5 test: emacs: toggle thread content indentation in `notmuch-show'
See commit c205e8ff.
2012-10-17 21:35:38 -03:00
Pieter Praet
5ea1dbe977 test: emacs: toggle eliding of non-matching messages in `notmuch-show'
See commits 44a544ed, 866ce8b1, 668b66ec.
2012-10-17 21:33:44 -03:00
Pieter Praet
09d19ac8c0 test: emacs: toggle eliding of non-matching messages in `notmuch-show'
See commits 44a544ed, 866ce8b1, 668b66ec.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
2012-10-17 21:31:13 -03:00
Austin Clements
54005b4625 test: Add a test for HTML email with inline images
Currently this test passes in Emacs 23 but fails in Emacs 24 (at least
on some Linux distributions).
2012-09-30 11:40:31 -03:00
Austin Clements
61a9448b58 test: Clear test-output output file before running Emacs tests
Most Emacs tests end with a call to (test-output), which saves the
buffer to a filed called OUTPUT.  Previously, if the test code failed
with an exception before this call, the test framework would then
compare against the OUTPUT file from the last Emacs test, resulting in
confusing diffs.

This requires one tweak to an emacs test that made two calls to
test_emacs and expected an OUTPUT file from the first call.  We simply
reverse the order of the test_emacs calls.
2012-09-30 11:40:22 -03:00
Mike Kelly
79a73cd46e test/atomicity: use a more portable 'cp' form
-a already implies -r/-R, so no need for both.

FreeBSD's cp complains:

  cp: the -R and -r options may not be specified together
2012-09-01 23:17:10 -03:00
Mike Kelly
02853e9839 test/basic: use portable args for find
`-executable` isn't available in FreeBSD's version of find, so use a
more portable version, `-perm +111`.
2012-09-01 23:16:57 -03:00
Mike Kelly
d29ff5699d tests: Test against source man pages.
Without this, help-test tests against the installed man pages, rather
than the default ones.
2012-09-01 23:16:39 -03:00
Mike Kelly
1652ea7d1b test/smtp-dummy.c: fix compilation on FreeBSD
Use the more portable netint/in.h, instead of netint/ip.h, to include
htons(3), etc.
2012-09-01 23:16:18 -03:00
Mike Kelly
8428e0465a test/Makefile.local: Use $(XAPIAN_LDFLAGS) for symbol-test
On FreeBSD, and probably anywhere else someone installed xapian to
some other prefix, we need to use XAPIAN_LDFLAGS to make the linker can
actually find libxapian.
2012-09-01 23:16:05 -03:00
Dmitry Kurochkin
1ffb382961 test: make test_expect_equal_file() arguments flexible
Before the change, test_expect_equal_file() function treated the first
argument as "actual output file" and the second argument as "expected
output file".  When the test fails, the files are copied for later
inspection.  The first files was copied to "$testname.output" and the
second file to "$testname.expected".  The argument order for
test_expect_equal_file() is often wrong which results in confusing
diff output and incorrectly named files.

The patch solves the issue by changing test_expect_equal_file() to
treat arguments just as two files, without any special properties
(like "actual" and "expected").  The file names for copying is now
based on the given file name: "$testname.$file1" and
"$testname.$file2".  E.g. if test_expect_equal_file() is called with
"OUTPUT" and "EXPECTED", the copied files can be named
"emacs.1.OUTPUT" and "emacs.1.EXPECTED".

The down side of this approach is that diff argument order depends on
test_expect_equal_file() argument order.  So sometimes we get diff
from expected to actual results, and sometimes the other way around.
But the files are always named correctly.
2012-09-01 23:09:26 -03:00
David Bremner
3ba01608d7 test: use (format "%S") to print nil in emacs test.
The behaviour of "emacsclient --eval nil" changed from emacs23 to
emacs24, and in emacs24 it prints 'nil' rather than an empty string.

(format "%S" foo) produces a sexpr form of foo, and is consistent
between the two versions.
2012-08-30 22:05:51 -03:00
David Bremner
e01706c993 test: canonicalize content-type in "Sending a message via (fake) SMTP"
The version of message.el in emacs24 omits the charset=us-ascii,
causing the current version of this test to fail. With this patch, we
accept either option.  According to RFC 2046, they are semantically
equivalent.
2012-08-30 20:19:36 -03:00
Tomi Ollila
3c053bf81c test: emacs: run list-processes after accept-process-output in emacs 23.1
When running emacs tests using emacs 23.1.1 the tests block (until timeout)
when emacs function (notmuch-test-wait) is called.

There is an emacs bug #2930 titled:
23.0.92; `accept-process-output' and `sleep-for' do not run sentinel

It seems this is present in emacs 23.1.

Calling list-processes after accept-process-output seems work around
this problem; in case Emacs version is 23.1 a defadvice is activated
to do just that.
2012-08-29 19:06:18 -03:00
Tomi Ollila
f791cc9247 test: emacs: call accept-process-output in notmuch-test-wait
notmuch-test-wait called sleep-for in a loop to wait unconditionally 0.1
seconds while waiting for process to exit.
accept-process-output returns as soon as there is any data available
from process, so using it avoids unnecessary fixed delays.
Both of these functions run process sentinels.
2012-08-29 19:06:07 -03:00
Mark Walters
94c3b40d41 sprinters: bugfix when NULL passed for a string.
The string function in a sprinter may be called with a NULL string
pointer (eg if a header is absent). This causes a segfault. We fix
this by checking for a null pointer in the string functions and update
the sprinter documentation.

At the moment some output when format=text is done directly rather than
via an sprinter: in that case a null pointer is passed to printf or
similar and a "(null)" appears in the output. That behaviour is not
changed in this patch.
2012-08-12 21:25:01 +02: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
David Bremner
19c824c3fd notmuch-restore: replace positional argument for input with option
Since notmuch dump doesn't use positional arguments anymore, it seems
better to be consistent.
2012-08-06 08:52:45 -03:00
David Bremner
760e17488e notmuch-dump: remove deprecated positional argument for output file
The syntax --output=filename is a smaller change than deleting the
output argument completely, and conceivably useful e.g. when running
notmuch under a debugger.
2012-08-06 08:52:33 -03:00
Austin Clements
624d1897ce test: Remove unnecessary JSON canonicalization
Format canonicalization of JSON output is no longer necessary, so
remove it.  Value canonicalization (e.g., normalizing thread IDs) is
still necessary, so all of the sanitization functions remain.
2012-08-03 20:16:45 -03:00
Austin Clements
a34bb1f9fa test: Uniformly canonicalize actual and expected JSON
Previously, we used a variety of ad-hoc canonicalizations for JSON
output in the test suite, but were ultimately very sensitive to JSON
irrelevancies such as whitespace.  This introduces a new test
comparison function, test_expect_equal_json, that first pretty-prints
*both* the actual and expected JSON and the compares the result.

The current implementation of this simply uses Python's json.tool to
perform pretty-printing (with a fallback to the identity function if
parsing fails).  However, since the interface it introduces is
semantically high-level, we could swap in other mechanisms in the
future, such as another pretty-printer or something that does not
re-order object keys (if we decide that we care about that).

In general, this patch does not remove the existing ad-hoc
canonicalization because it does no harm.  We do have to remove the
newline-after-comma rule from notmuch_json_show_sanitize and
filter_show_json because it results in invalid JSON that cannot be
pretty-printed.

Most of this patch simply replaces test_expect_equal and
test_expect_equal_file with test_expect_equal_json.  It changes the
expected JSON in a few places where sanitizers had placed newlines
after commas inside strings.
2012-08-03 20:14:47 -03:00
David Bremner
8a745d310f build system: remove directories created by tests in "make clean"
These extra directories cause problems for building on Debian
twice in a row.

In order to remove directories, we need to us "rm -rf" instead of
"rm -f". So now we should be extra careful what we add to the
variable CLEAN.
2012-08-02 21:09:45 -03:00
Mark Walters
3ea77f9f1f test: add tests for the new --body=true|false option 2012-07-24 15:29:38 -03:00
craven@gmx.net
10ab2b5703 Use the structured formatters in notmuch-search.c.
This patch switches from the current ad-hoc printer to the structured
formatters in sprinter.h, sprinter-text.c and sprinter-json.c.

The JSON tests are changed slightly in order to make them PASS for the
new structured output formatter.

The text tests pass without adaptation.
2012-07-24 09:27:09 -03:00
Austin Clements
9c5ea07cc6 emacs: Switch from text to JSON format for search results
The JSON format eliminates the complex escaping issues that have
plagued the text search format.  This uses the incremental JSON parser
so that, like the text parser, it can output search results
incrementally.

This slows down the parser by about ~4X, but puts us in a good
position to optimize either by improving the JSON parser (evidence
suggests this can reduce the overhead to ~40% over the text format) or
by switching to S-expressions (evidence suggests this will more than
double performance over the text parser).  [1]

This also fixes the incremental search parsing test.

This has one minor side-effect on search result formatting.
Previously, the date field was always padded to a fixed width of 12
characters because of how the text parser's regexp was written.  The
JSON format doesn't do this.  We could pad it out in Emacs before
formatting it, but, since all of the other fields are variable width,
we instead fix notmuch-search-result-format to take the variable-width
field and pad it out.  For users who have customized this variable,
we'll mention in the NEWS how to fix this slight format change.

[1] id:"20110720205007.GB21316@mit.edu"
2012-07-12 17:39:36 -06:00
Austin Clements
f94a50d80a test: New test for incremental search output parsing
This advises the search process filter to make it process one
character at a time in order to test the pessimal case for incremental
search output parsing.

The text parser fails this test because it gets tricked into thinking
a parenthetical remark in a subject is the tag list.
2012-07-12 17:39:18 -06: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
Austin Clements
b88030bda6 lib: Treat messages in new/ as maildir messages with no flags set
Previously, notmuch new only synchronized maildir flags to tags for
files with a maildir "info" part.  Since messages in new/ don't have
an info part, notmuch would ignore them for flag-to-tag
synchronization.

This patch makes notmuch consider messages in new/ to be legitimate
maildir messages that simply have no maildir flags set.  The most
visible effect of this is that such messages now automatically get the
unread tag.
2012-06-10 20:14:56 -03:00
Austin Clements
b0d0dab22a test: Add broken test for tag synchronization on files delivered to new/
Currently, notmuch new only synchronizes maildir flags to tags for
files that have an "info" part.  However, in maildir, new mail doesn't
gain the info part until it moves from new/ to cur/.  Hence, even
though mail in new/ doesn't have an info part, it is still a maildir
message and thus has maildir flags (though none of them set).

The most visible effect of not synchronizing maildir flags for
messages in new/ is that newly delivered messages don't get the unread
tag (unless it is assigned by some other mechanism, like new.tags).

This patch does *not* modify the test for messages in cur/ that do not
have an "info" part.  Unlike a message in new/, a message in cur/
without an info part is no longer a maildir message, and thus
shouldn't be subject to maildir flag synchronization.
2012-06-10 20:13:19 -03:00
Jani Nikula
0ff57e75cf emacs: only strip "re:" in the beginning of subject
Fix notmuch-show-strip-re by matching "re:" only in the beginning of
the input string.
2012-06-07 23:28:17 -03:00
Jani Nikula
627f7b27f9 test: add test for emacs notmuch-show-strip-re function
The function is used for stripping "re:" from subjects to generate
"bare subjects". Include broken test for having "re:" in the middle of
the subject.
2012-06-07 23:26:26 -03:00
Dmitry Kurochkin
0bef41bf10 test: remove "Testing" from test description in emacs-hello and emacs-show
"Testing" is printed by test/test-lib.sh, so having "Testing" in test
description results in duplicate "Testing" in console output.
2012-05-25 21:38:54 -03:00
Jani Nikula
2f1a11268f test: add tests for notmuch reply From guessing
Add tests for picking up user's From address from fallback headers
Envelope-To, X-Original-To, and Delivered-To.

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-05-24 21:56:35 -03:00
Austin Clements
d99270c450 new: Centralize file type stat-ing logic
This moves our logic to get a file's type into one function.  This has
several benefits: we can support OSes and file systems that do not
provide dirent.d_type or always return DT_UNKNOWN, complex
symlink-handling logic has been replaced by a simple stat fall-through
in one place, and the error message for un-stat-able file is more
accurate (previously, the error always mentioned directories, even
though a broken symlink is not a directory).
2012-05-24 21:53:08 -03:00
Austin Clements
72c944655f test: Test notmuch new with a broken symlink 2012-05-24 21:52:53 -03:00
Austin Clements
54508eb78d python: Remove find_message_by_filename workaround
Now that notmuch_database_find_message_by_filename works on read-only
databases, remove the workaround that disabled it on read-write
databases.

This also adds a regression test for find_message_by_filename.
2012-05-23 22:32:02 -03:00
Dmitry Kurochkin
4997ec9571 emacs: fix custom queries section customization widget in notmuch-hello
The customization widget referred to a non-existing function
`notmuch-hello-insert-query-list'.  The patch changes it to the
correct one - `notmuch-hello-insert-searches'.  The relevant test is
fixed now.
2012-05-06 19:44:55 -03:00
Dmitry Kurochkin
512df7ec47 test: add Emacs notmuch-hello tests for custom tags and queries section.
The tests use default values from customization widgets to make sure
that these customization widgets work (at least on basic level).

The custom queries section test is currently broken.
2012-05-06 19:44:42 -03:00
Adam Wolfe Gordon
97efed0f08 test: Force reply to use html2text for consistency
The output of the HTML reply test in the emacs suite can vary
depending on which HTML renderers are installed on the machine running
the tests. The renderer that is always available is emacs's builtin
html2text function. In order to get consistency, force the test to use
html2text even if other renderers are available.
2012-05-06 19:41:52 -03:00
Adam Wolfe Gordon
f6c170fabc emacs: Correctly quote non-text/plain parts in reply
Quote non-text parts nicely by displaying them with mm-display-part
before calling message-cite-original to quote them. HTML-only emails
can now be quoted correctly. We re-use some code from notmuch-show
(notmuch-show-mm-display-part-inline), which has been moved to
notmuch-lib.el.

Mark the test for this feature as not broken.
2012-05-06 08:48:11 -03:00
Adam Wolfe Gordon
7fb8ab9f0b test: Replying to an HTML-only message in emacs
With the latest reply infrastructure, we should be able to nicely
quote HTML-only emails. But currently emacs quotes the raw HTML
instead of parsing it first. This commit adds a test for this case.

This test currently marked as broken.
2012-05-06 08:47:56 -03:00
Austin Clements
5fddc07dc3 lib/cli: Make notmuch_database_open return a status code
It has been a long-standing issue that notmuch_database_open doesn't
return any indication of why it failed.  This patch changes its
prototype to return a notmuch_status_t and set an out-argument to the
database itself, like other functions that return both a status and an
object.

In the interest of atomicity, this also updates every use in the CLI
so that notmuch still compiles.  Since this patch does not update the
bindings, the Python bindings test fails.
2012-05-05 10:11:57 -03:00
Peter Wang
d32de8b3c0 config: Add 'config list' command
Add a command to list all configuration items with their associated
values.

One use is as follows: a MUA may prefer to store data in a central
notmuch configuration file so that the data is accessible across
different machines, e.g. an addressbook.  The list command helps
to implement features such as tab completion on the keys.
2012-04-28 10:45:31 -03:00
Peter Wang
86f01063d7 test: Add broken test for 'config list'
Proposed functionality.
2012-04-28 10:44:57 -03:00
Peter Wang
b8c7707d4d test: Add tests for 'config' command
Start a new test script.
2012-04-28 10:14:10 -03:00
Dmitry Kurochkin
6409a27b2c emacs: get rid of trailing spaces in notmuch-hello view
This patch removes trailing spaces in notmuch-hello view.

A side effect of this change is that tag/query buttons no longer
include a space at the end.  This means that pressing RET when the
point is at the first character after the tag/query button no longer
works (note that this is the standard behavior for buttons).  We may
change this behavior in the future (without adding trailing spaces
back) if people would find this change inconvenient.
2012-04-12 08:40:33 -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
Mark Walters
785c1e497f cli: move count to the new --exclude=(true|false|flag) naming scheme.
Move the option --no-exclude to the --exclude= scheme. Since there is
no way to flag messages only true and false are implemented. Note
that, for consistency with other commands, this is implemented as a
keyword option rather than a boolean option.
2012-04-07 23:05:18 -03:00
Dmitry Kurochkin
1361dd37bc emacs: fix off-by-one error in notmuch-hello column alignment
Expected results for few tests are fixed, the relevant test is
unmarked broken.
2012-04-05 07:40:12 -03:00
Dmitry Kurochkin
818790f7b5 test: add broken test for long names in Emacs notmuch-hello view
Currently, the column alignment in Emacs notmuch-hello is broken for
tags/queries with long names.
2012-04-05 07:37:53 -03:00
Adam Wolfe Gordon
e4844fafec emacs: Fix the References header in reply
In the new reply code, the References header gets inserted by
message.el using a function called message-shorten-references. Unlike
all the other header-inserting functions, it doesn't put a newline
after the header, causing the next header to end up on the same
line. In our case, this header happened to be User-Agent, so it's hard
to notice. This is probably a bug in message.el, but we need to work
around it.

This fixes the problem by wrapping message-shorten-references in a
function that inserts a newline after if necessary. This should
protect against the message.el bug being fixed in the future.
2012-04-02 17:47:04 -03:00
Adam Wolfe Gordon
bc531924e0 test: Show all headers in emacs reply tests
By default, emacs hides the User-Agent and References headers when
composing mail. This is a good thing for users, but a bad thing for
testing, since we can create ugly or invalid headers and not have it
show up in the tests.

By setting message-hidden-headers to an empty list, we force emacs to
show all the headers, so we can check that they're correct. Users
won't see this, but it will let us catch future bugs.

As a side-effect, this breaks all the reply tests, since there is a
bug with the References and User-Agent headers, fixed in the next commit.
2012-04-02 17:45:36 -03:00
Adam Wolfe Gordon
3737ca6e26 emacs: Fix two bugs in reply
Bug 1: Replying from alternate addresses
----------------------------------------

The reply code was inconsistent in its use of symbols and strings for
header names being passed to message.el functions. This caused the
From header to be lookup up incorrectly, causing an additional From
header to be added with the user's primary address instead of the
correct alternate address.

This is fixed by using symbols everywhere, i.e. never using strings
for header names when interacting with message.el.

This change also removes our use of `mail-header`, since we don't use
it anywhere else, and using assq makes it clear how the header lists
are expected to work.

Bug 2: Duplicate headers in emacs 23.2
--------------------------------------

The message.el code in emacs 23.2 assumes that header names will
always be passed as symbols, so our use of strings caused
problems. The symptom was that on 23.2 (and presumably on earlier
versions) the reply message would end up with two of some headers.

Converting everything to symbols also fixes this issue.
2012-04-02 17:45:27 -03:00
Adam Wolfe Gordon
b45b72aa14 test: Tests for reply from alternate addresses in emacs
Since the recent reply changes were pushed, there has been a bug that
causes emacs to always reply from the primary address, even if the
JSON or default CLI reply output uses an alternate address.

This adds two tests to the emacs test library based on the two "Reply
form..." tests in the reply test library. One is currently marked
broken.
2012-04-02 17:45:16 -03:00
Austin Clements
ee1180018e emacs: Escape all message ID queries
This adds a lib function to turn a message ID into a properly escaped
message ID query and uses this function wherever we previously
hand-constructed ID queries.  Wherever this new function is used,
documentation has been clarified to refer to "id: queries" instead of
"message IDs".

This fixes the broken test introduced by the previous patch.
2012-03-30 21:27:03 -03:00
Austin Clements
5ae960fc19 test: Add Emacs test for messages with quotes in their message ID
Currently this is broken because Emacs doesn't properly escape double
quotes in message IDs.
2012-03-30 21:23:43 -03:00
Jani Nikula
8e3ff8fb03 cli: refactor "notmuch tag" data structures for tagging operations
To simplify code, keep all tagging operations in a single array
instead of separate add and remove arrays. Apply tag changes in the
order specified on the command line, instead of first removing and
then adding the tags.

This results in a minor functional change: If a tag is both added and
removed, the last specified operation is now used. Previously the tag
was always added. Change the relevant test to reflect the new
behaviour.

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-03-30 21:20:36 -03:00
Jani Nikula
918b803597 test: add test for both adding and removing a tag at the same time
The current behaviour is that regardless of the order in which the
addition and removal of a tag are specified, the tag is added.

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-03-30 21:20:21 -03:00
Adam Wolfe Gordon
650123510c emacs: Use the new JSON reply format and message-cite-original
Use the new JSON reply format to create replies in emacs. Quote HTML
parts nicely by using mm-display-part to turn them into displayable
text, then quoting them with message-cite-original. This is very
useful for users who regularly receive HTML-only email.

Use message-mode's message-cite-original function to create the
quoted body for reply messages. In order to make this act like the
existing notmuch defaults, you will need to set the following in
your emacs configuration:

message-citation-line-format "On %a, %d %b %Y, %f wrote:"
message-citation-line-function 'message-insert-formatted-citation-line

The tests have been updated to reflect the (ugly) emacs default.
2012-03-19 22:03:23 -03:00
Adam Wolfe Gordon
8420ba1035 test: Add broken tests for new emacs reply functionality
Add tests for creating nice replies to multipart messages, including
those with HTML parts. These tests are expected to fail for now.
2012-03-19 22:01:13 -03:00
Adam Wolfe Gordon
1904b01b96 reply: Add a JSON reply format.
This new JSON format for replies includes headers generated for a
reply message as well as the headers of the original message.  Using
this data, a client can intelligently create a reply. For example, the
emacs client will be able to create replies with quoted HTML parts by
parsing the HTML parts.
2012-03-19 21:53:53 -03:00
Adam Wolfe Gordon
30172649e8 test: Add broken test for the new JSON reply format. 2012-03-19 21:50:47 -03:00
Mark Walters
1351aafac1 test: add tests for message only search
This adds three tests for --output=messages searches. One test is for
the case when one exclude tag does not occur in the Xapian
database. This triggers a Xapian bug in some cases and causes the
whole exclusion to fail. The next commit avoids this bug.
2012-03-18 09:14:23 -03:00
Mark Walters
fb36741bf3 test: the test for the exclude code mistakenly excludes the tag "="
The tests for the exclude code in search and count use the line
    notmuch config set search.exclude_tags = deleted
which actually sets the exclude tags to be "=" and "deleted". Remove
the "=" from this line.
2012-03-18 09:14:23 -03:00
Dmitry Kurochkin
db97cb5b65 test: use subtest name for generated message subject by default
Before the change, messages generated by generate_message() used "Test
message #N" for default subject where N is the generated messages
counter.  Since message subject is commonly present in expected
results, there is a chance of breaking other tests when a new
generate_message() call is added.  The patch changes default subject
value for generated messages to subtest name if it is available.  If
subtest name is not available (i.e. message is generated during test
initialization), the old default value is used (in this case it is
fine to have the counter in the subject).

Another benefit of this change is a sane default value for subject in
generated messages, which would allow to simplify code like:

  test_begin_subtest "test for a cool feature"
  add_message [subject]="message for test for a cool feature"
2012-03-18 09:14:22 -03:00
Dmitry Kurochkin
6511b08fb8 test: remove "Generate some messages" test from raw
Before the change, the first subtest in raw format tests just
generated messages and checked that they are added successfully.  This
is not really a raw format test, it is creating of environment
required for other subtests to run.  The patch removes the first
subtest from raw and replaces it with bare add_message calls, similar
to how it is done in other tests.

TODO: we should check that test environment was created successfully.
Currently, many tests do add_message(), notmuch new and other calls
without checking the results.  We should come up with a general
solution for this, i.e. if any command during test initialization
fails, all tests should be skipped with appropriate error message.
2012-03-18 09:14:22 -03:00
Austin Clements
b1130bc71c show: Convert raw format to the new self-recursive style, properly support interior parts
This is fully compatible for root and leaf parts, but now has proper
support for interior parts.  This requires some design decisions that
were guided by what I would want if I were to save a part.
Specifically:

- Leaf parts are printed without headers and with transfer decoding.
  This is what makes sense for saving attachments.  (Furthermore, the
  transfer decoding is necessary since, without the headers, the
  caller would not be able to interpret non-transfer-decoded output.)

- Message parts are printed with their message headers, but without
  enclosing part headers.  This is what makes sense for saving a
  message as a whole (which is a message part) and for saving attached
  messages.  This is symmetric for whole messages and for attached
  messages, though we special-case the whole message for performance
  reasons (and corner-case correctness reasons: given malformed input,
  GMime may not be able to reproduce it from the parsed
  representation).

- Multipart parts are printed with their headers and all child parts.
  It's not clear what the best thing to do for multipart is, but this
  was the most natural to implement and can be justified because such
  parts can't be interpreted without their headers.

As an added benefit, we can move the special-case code for part 0 into
the raw formatter.
2012-03-18 09:14:22 -03:00
Austin Clements
046ab77b10 test: Fix malformed multipart message
Previously, there was only one CRLF between the terminating boundary
of the embedded multipart/alternative and the boundary of the
containing multipart.  However, according the RFC 1341, 7.2.1:

  The boundary must be followed immediately either by another CRLF and
  the header fields for the next part, or by two CRLFs, in which case
  there are no header fields for the next part

and

  The CRLF preceding the encapsulation line is considered part of the
  boundary so that it is possible to have a part that does not end
  with a CRLF (line break).

Thus, there must be *two* CRLFs between these boundaries: one that
ends the terminating boundary and one that begins the enclosing
boundary.

While GMime accepted the message we had before, it could not produce
such a message.
2012-03-18 09:14:21 -03:00
Austin Clements
d2e96a35a5 test: Fix typo in test description
Part 4 is a multipart, not an html part.
2012-03-18 09:14:21 -03:00
David Bremner
0c20878cce Merge branch 'release' 2012-03-13 22:09:56 -03:00
Thomas Jost
f34613ea83 build: Require gmime >= 2.6.7
gmime-2.6 had a bug [1] which made it impossible to tell why a signature
verification failed when the signer key was unavailable (empty "sigstatus" field
in the JSON output). Since 00b5623d the corresponding test is marked as broken
when using gmime-2.6 (2.4 is fine).

This bug has been fixed in gmime 2.6.5, which is now the minimal gmime-2.6
version required for building notmuch (gmime-2.4 is still available). As a
consequence the version check in test/crypto can be removed.

[Added by db]

Although less unambigously a bug, Gmime 2.6 prior to 2.6.7 also was
more strict about parsing, and rejected messages with initial "From "
headers.  This restriction is relaxed in [2].  For reasons explained in [3],
we want to keep this more relaxed parsing for now.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=668085

[2] http://git.gnome.org/browse/gmime/commit/?id=d311f576baf750476e06e9a1367a2dc1793ea7eb

[3] id:"1331385931-1610-1-git-send-email-david@tethera.net"
2012-03-11 22:13:48 -03:00
Mark Walters
c8cf9e92d8 test: update tests to reflect the exclude flag
notmuch show outputs the exclude flag so many tests using notmuch
show failed. This commit adds "excluded:0" or "excluded: false" to
the expected outputs. After this commit there should be no failing
tests.
2012-03-02 08:35:02 -04:00
Mark Walters
c440e597f9 test: update search test to reflect exclude flag
notmuch-search.c now returns all matching threads even if it the
match is a search.tag_excluded message (but with a mark indicating
this). Update the test to reflect this.
2012-03-02 08:31:42 -04:00
Mark Walters
98f5b0f09a test: add tests for new cli --no-exclude option
The tests test the new --no-exclude option to search and count.
There were no existing tests for the exclude behaviour for count so
added these too.
2012-03-02 08:25:46 -04:00
Austin Clements
86f89385c3 show: Unify JSON header output for messages and message parts
This has three ramifications:
- Blank To and Cc headers are no longer output for messages.
- Dates are now canonicalized for messages, which means they always
  have a day of the week and GMT is printed +0000 (never -0000)
- Invalid From message headers are handled slightly differently, since
  they get parsed by GMime now instead of notmuch.
2012-03-01 08:28:13 -04:00
Austin Clements
2209d7b952 show: Use consistent header ordering in the JSON format
Previously, top-level message headers were printed as Subject, From,
To, Date, while embedded message headers were printed From, To,
Subject, Date.  This makes both cases use the former order and updates
the tests accordingly.
2012-03-01 08:28:02 -04: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
Michal Sojka
1093c24dcc test: Remove 'broken' flag from encoding test 2012-02-29 07:41:55 -04:00
Michal Sojka
74f8f15adc test: Add test for searching of uncommonly encoded messages
Emails that are encoded differently than as ASCII or UTF-8 are not
indexed properly by notmuch. It is not possible to search for non-ASCII
words within those messages.
2012-02-29 07:34:54 -04:00
Austin Clements
17a06ab990 emacs: Reverse the meaning of notmuch-show-refresh-view's argument
Consensus seems to be that people prefer that refreshing show buffers
retains state by default, rather than resetting it by default.  This
turns out to be the case in the code, as well.  In fact, there's even
a test for this that's been marked broken for several months, which
this patch finally gets to mark as fixed.
2012-02-25 10:35:22 -04:00
Pieter Praet
2f86290aaf emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
* emacs/notmuch-show.el

  (notmuch-show-stash-mlarchive-link-alist):
    New defcustom of type `alist' (key = name, value = URI),
    containing Mailing List Archive URI's for searching by Message-Id.

  (notmuch-show-stash-mlarchive-link-default):
    New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link'
    received no user input whatsoever.  Available choices are generated using
    the contents of `notmuch-show-stash-mlarchive-link-alist'.

  (notmuch-show-stash-map):
    Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link'
    respectively `notmuch-show-stash-mlarchive-link-and-go'.

  (notmuch-show-stash-mlarchive-link):
    New function, stashes a URI pointing to the current message at one
    of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.
    Prompts user with `completing-read' if not provided with an MLA key.

  (notmuch-show-stash-mlarchive-link-and-go):
    New function, uses `notmuch-show-stash-mlarchive-link' to
    stash a URI, and then visits it using the browser configured
    in `browse-url-browser-function'.

Based on original work [1] by David Edmondson <dme@dme.org>.

[1] id:"1327397873-20596-1-git-send-email-dme@dme.org"
2012-02-25 10:34:27 -04:00
Pieter Praet
e2a68f9941 test: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List Archive URIs
`notmuch-show-stash-mlarchive-link' stashes a URI pointing to the current message
at one of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.

Marked as "broken": fixed in next commit.
2012-02-25 10:34:16 -04:00
Pieter Praet
b32831e5b8 test: replace occurrences of $PWD with vars that are more stable
Thanks to Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
for pointing this out:  id:"87d39ymyb4.fsf@gmail.com"
2012-02-25 08:48:47 -04:00
Pieter Praet
e3fb62f59b test: always report missing prereqs, independent of `--verbose' option
When tests are skipped due to missing prereqs, those prereqs are only
displayed when running with the `--verbose' option.  This is essential
information when troubleshooting, so always send to stdout.
2012-02-20 23:24:20 -04:00
Tomi Ollila
ce1e720de6 add support for user-specified files & directories to ignore
A new configuration key 'new.ignore' is used to determine which
files and directories user wants not to be scanned as new mails.

Mark the corresponding test as no longer broken.
This work merges my previous attempts and Andreas Amann's work
in id:"ylp7hi23mw8.fsf@tyndall.ie"
2012-02-17 08:04:34 -04:00
Tomi Ollila
863c149514 test: add tests wrt ignoring user-specified files and directories
Files and directories which are specified in 'new.ignore' in the
config file shouldn't be indexed nor reported by `notmuch new'.

This is basically Pieter's work with Austin's comments addressed.
2012-02-17 08:04:23 -04:00
Austin Clements
c0cd090412 show: Simplify new text formatter code
This makes the text formatter take advantage of the new code
structure.  The previously duplicated header logic is now unified,
several things that we used to compute repeatedly across different
callbacks are now computed once, and the code is simpler overall and
32% shorter.

Unifying the header logic causes this to format some dates slightly
differently, so the two affected test cases are updated.
2012-02-12 11:58:20 -05:00
Dmitry Kurochkin
8d26b8eaac test: remove explicit loading of elisp tests in emacs-address-cleaning
It is no longer needed, since elisp tests files are auto loaded now.
2012-02-12 11:58:20 -05:00
Dmitry Kurochkin
754ddbb578 test: auto load elisp tests file in test_emacs if available
This allows us to simplify shell part of tests written in elisp.
2012-02-12 11:58:20 -05:00
Dmitry Kurochkin
148a96c43d test: fix emacs tests after tagging operations changes
After the recent tagging operations changes, functions bound to "+"
and "-" in notmuch-search and notmuch-show views always read input
from the minibuffer.  Use kbd macros instead of calling them directly.
2012-02-08 11:14:10 -04:00
David Bremner
57702cc430 test: Fix up date in MML quoting tests.
based on id:"1328264649-27346-3-git-send-email-pieter@praet.org"

Commit 66ecd9063 made dates "real", but it hasn't hit release yet.
2012-02-04 13:37:33 -05:00
David Bremner
d43f6c00b3 Merge commit '0.11.1'
Conflicts:
	NEWS
	bindings/python/notmuch/database.py
	bindings/python/notmuch/message.py
	notmuch.1

NEWS merged by hand, others taken from master.
2012-02-04 12:01:46 -05:00
Dmitry Kurochkin
8281430558 emacs: fix `notmuch-wash-region-to-button' to work at beginning of buffer
`Notmuch-wash-region-to-button' is the function that creates hidden
regions with buttons for signatures, citations and original messages.
Before the change, it did not work correctly if the to-be-hidden
region started at the beginning of a message: the visibility toggle
button was hidden as well.  The patch fixes this.  There are two parts
in the fix:

* Use `insert-before-markers' instead of `insert' for creating the
  button, so that it does not get added to the hidden overlay.

* Stop using PREFIX argument for adding a newline before the button.
  The newline should not be added before a button at the beginning of
  buffer.

The corresponding test is fixed now.
2012-02-04 07:33:18 -05: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
David Edmondson
32d7b3aabd emacs: More address cleaning.
Remove outer single-quotes from the mailbox part. Allow for multiple
sets of nested single and double quotes.

Add more tests.
2012-02-03 21:24:48 -04: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
Aaron Ecay
ae438ccd8c emacs: quote MML tags in replies
Emacs message-mode uses certain text strings to indicate how to attach
files to outgoing mail.  If these are present in the text of an email,
and a user is tricked into replying to the message, the user’s files
could be exposed.

Edited-by: Pieter Praet <pieter@praet.org>:  Rebased to release branch.
2012-02-03 08:26:41 -04:00
Aaron Ecay
3f2050ac22 test: add tests for quoting of MML tags in replies
The test is broken at this time; the next commit will introduce a fix.

Edited-by: Pieter Praet <pieter@praet.org>:
  Rebased to release branch, moved expected output into the actual test,
  and fixed "Fcc:" line.
2012-02-03 08:26:27 -04:00
David Edmondson
cd03f21447 emacs: Another special case for `notmuch-show-clean-address'.
Remove backslashes.
2012-01-27 07:59:40 -04:00
David Edmondson
50d65de394 test: Updated expected output for new `notmuch-show-clean-address'. 2012-01-27 07:59:23 -04:00
David Edmondson
cbc4876a33 emacs: Avoid mail-header-parse-address' in notmuch-show-clean-address'.
`mail-header-parse-address' expects un-decoded mailbox parts, which is
not what we have at this point. Replace it with simple string
deconstruction.

Mark the corresponding test as no longer broken.

Minor whitespace cleanup.
2012-01-27 07:58:58 -04:00
David Edmondson
2f50524e27 test: `notmuch-test-run' should protect against buffer switching.
The body of the test may cause the current buffer to change. Ensure
that the output goes to the correct buffer by switching back before
inserting it.
2012-01-26 08:35:15 -04:00
David Edmondson
c70c7f86b8 test: `visible-buffer-substring' should not return text properties.
When using `visible-buffer-substring' to examine a buffer, the text
properties are not useful, so don't include them.
2012-01-26 08:35:02 -04:00
Dmitry Kurochkin
d0a048f856 emacs: polish notmuch-hello help text
Make `=' binding description consistent with others.
2012-01-26 08:20:40 -04:00
Dmitry Kurochkin
02d8815922 emacs: bind "s" to `notmuch-search' in notmuch-hello buffer
Before the change, "s" in notmuch-hello buffer would jump to the
search box.  The patch changes the binding to `notmuch-search' which
is consistent with all other notmuch buffers.
2012-01-25 08:33:27 -04:00
David Edmondson
3699fedb3a test: Add address cleaning tests. 2012-01-25 07:27:01 -04:00
David Edmondson
f92d7dee8f test: Add more helpers for emacs tests. 2012-01-25 07:26:47 -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
David Edmondson
2903b32f79 test: Don't return the result of checking for running emacs to the tester.
When checking for a running emacs, test_emacs evaluates the empty list
'()'. This returns 'nil' when emacs is running, which is then
prepended to the actual test result. Given that it is not part of the
actual test output the test harness can incorrectly report test
failure (or success).
2012-01-25 07:25:25 -04:00
Pieter Praet
ba33a15ec3 config: only exclude messages if 'search.exclude_tags' is explicitly set
Currently, the 'search.exclude_tags' option is automatically
set to "deleted;spam;" if it's missing from the config file.

This violates the Principle of Least Surprise, so *only* set
'search.exclude_tags' to "deleted;spam;" if we didn't find a
configuration file at all.

This patch is actually Austin Clements' work:
  id:"20120117203211.GQ16740@mit.edu"
2012-01-23 19:21:18 -04:00
Pieter Praet
6795c62a50 test: only exclude "deleted" messages from search if explicitly configured
Currently, the 'search.exclude_tags' option is automatically set to
"deleted;spam;" if it's missing from the config file.

This violates the Principle of Least Surprise, so update the tests to
*only* expect the exclusion of messages which are tagged "deleted" if the
'search.exclude_tags' option is explicitly set *and* contains that tag.
2012-01-23 19:19:26 -04:00
Austin Clements
0bd09f8446 show: Use consistent header ordering in the text format
Previously, top-level message headers were printed as Subject, From,
To, Date, while embedded message headers were printed From, To,
Subject, Date.  This makes both cases use the former order and updates
the tests accordingly.

Strangely, the raw format also uses this function, so this also fixes
the two raw format tests affected by this change.
2012-01-23 07:41:46 -04:00
Pieter Praet
80771e3c76 test/emacs-large-search-buffer: correct typo (EXPEXTED -> EXPECTED)
introduced in commit 3b24b396
2012-01-23 07:38:32 -04:00
Tomi Ollila
a04642043f test: make (kill-emacs) from emacsclient work with emacs 23.(1|2)
emacsclient --eval '(kill-emacs)' makes emacs versions 23.1
and 23.2 ask user input from running emacs. Redefining
yes-or-no-p function when kill-emacs is executed for these
emacs versions in test-lib.el avoids this test problem.
2012-01-22 09:18:20 -04:00
Tomi Ollila
da9f392165 test: whitespace-cleanup for most test/* files
Used emacs (whitespace-cleanup) function to "cleanup blank problems"
in test files where that could be done without breaking tests;
test/emacs was partially, and test/multipart was fully reverted.
2012-01-22 09:12:12 -04:00
Thomas Jost
00b5623d1a Add compatibility with gmime 2.6
There are lots of API changes in gmime 2.6 crypto handling. By adding
preprocessor directives, it is however possible to add gmime 2.6 compatibility
while preserving compatibility with gmime 2.4 too.

This is mostly based on id:"8762i8hrb9.fsf@bookbinder.fernseed.info".

This was tested against both gmime 2.6.4 and 2.4.31. With gmime 2.4.31, the
crypto tests all work fine (as expected). With gmime 2.6.4, one crypto test is
currently broken (signature verification with signer key unavailable), most
likely because of a bug in gmime which will hopefully be fixed in a future
version.
2012-01-21 08:52:34 -04:00
Dmitry Kurochkin
d3aa6848da emacs: add invisible dot instead of space at the end of notmuch-hello search box
This makes `show-trailing-whitespace' happy, i.e. it does not mark the
whole search box line as trailing spaces.

Since the dot is invisible, this change makes no visible difference
for `notmuch-hello'.

Edited-by: Pieter Praet <pieter@praet.org> to fix the tests.
2012-01-21 08:50:48 -04:00
Ethan Glasser-Camp
8ae753f30f Document external dependencies in the test suite
Add an explicit note to the README explaining what programs are
necessary and the perhaps-surprising behavior of skipping tests if
they aren't present.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
2012-01-21 08:28:47 -04:00
Austin Clements
5c12ee4b5d Fix dependency generation for compat, test, and util
This adds source files in compat, test, and util to SRCS so that the
top-level Makefile.local will generate dependency files for them.
2012-01-19 09:19:12 -04:00
Austin Clements
42a9079928 search: Support automatic tag exclusions
This adds a "search" section to the config file and an
"auto_tag_exclusions" setting in that section.  The search and count
commands pass tag tags from the configuration to the library.
2012-01-16 21:06:35 -04:00
Jani Nikula
982096d79d cli: pick the user's address in a group list as from address
Messages received to a group list were not replied to using the from
address in the list. Fix it.

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-01-16 21:06:34 -04:00
Jani Nikula
93150f6467 test: add known broken test for reply from address in named group list
If a message was received to the user's address that was in a named
group list, notmuch reply does not use that address for picking the
from address.

Groups lists are of the form: foo:bar@example.com,baz@example.com;

Signed-off-by: Jani Nikula <jani@nikula.org>
2012-01-16 21:06:34 -04:00
Pieter Praet
42e8f66edf test: don't bail out of `run_emacs' too early when missing prereqs
When running the Emacs tests in verbose mode, only the first missing
prereq is reported because the `run_emacs' function is short-circuited
early:

  #+begin_example
    emacs: Testing emacs interface
     missing prerequisites: [0]  emacs(1)
     skipping test: [0]  Basic notmuch-hello view in emacs
     SKIP   [0]  Basic notmuch-hello view in emacs
  #+end_example

This can lead to situations reminiscent of "dependency hell", so instead
of returning based on each individual `test_require_external_prereq's exit
status, we now do so only after checking all the prereqs:

  #+begin_example
    emacs: Testing emacs interface
     missing prerequisites: [0]  dtach(1) emacs(1) emacsclient(1)
     skipping test: [0]  Basic notmuch-hello view in emacs
     SKIP   [0]  Basic notmuch-hello view in emacs
  #+end_example

Also added missing prereq for dtach(1).
2012-01-15 22:37:07 -04:00
Mark Walters
15ea8625d1 test: add tests for "notmuch reply" --reply-to=sender 2012-01-14 11:11:18 -04:00
David Bremner
0bbfc5ce8b Merge branch 'release'
Conflicts:
	notmuch-reply.c
	notmuch.1
2012-01-13 20:52:01 -04:00
Patrick Totzke
ab69d6efa0 python test "compare message ids"
Introduces a second (trivial) test for the python
bindings that searches for message ids and compares
the output with that of `notmuch search`.
2012-01-08 13:46:50 +01:00
Patrick Totzke
aadf202dd5 clean up "compare thread ids" python test
This makes the test script open the database in READ_ONLY mode
and use the libraries own sorting methods instead of "sort".
2012-01-08 13:46:25 +01:00
Jameson Graef Rollins
74bced62b4 emacs: fix notmuch-show-indent-messages-width customization variable name
The name was originally notmuch-indent-messages-width, which is
inconsistent with our variable naming convention.
2012-01-05 17:48:46 -04:00
Kazuo Teramoto
442d405ad3 lib: call g_mime_init() from notmuch_database_open()
As reported in
id:"CAEbOPGyuHnz4BPtDutnTPUHcP3eYcRCRkXhYoJR43RUMw671+g@mail.gmail.com"
sometimes gmime tries to access a NULL pointer, e.g. g_mime_iconv_open()
tries to access iconv_cache that is NULL if g_mime_init() is not called.
This causes notmuch to segfault when calling gmime functions.

Calling g_mime_init() initializes iconv_cache and others variables needed
by gmime, making sure they are initialized when notmuch calls gmime
functions.

Test marked fix by db.
2011-12-31 23:08:15 -04:00
David Bremner
7da6733e89 test: add two new messages to corpus with iso-8859-1 encoding
One is quoted printable, the other users 8 bit encoding. The latter
triggers a bug in the python bindings due to missing call to
g_mime_init. The corresponding test is marked broken in this commit.
2011-12-31 23:04:01 -04:00
David Bremner
bebf80ea68 test: use file based comparison for search '*' test
This seems a bit easier to maintain, and is more accurate since lines
are not joined together.
2011-12-31 22:59:58 -04:00
Tomi Ollila
347f39d73e test/symbol-hiding: prepend new directory to LD_LIBRARY_PATH
Tester may have set LD_LIBRARY_PATH to find libraries required
by notmuch. Therefore add $TEST_DIRECTORY/../lib to the beginning
of current list of library paths in $LD_LIBRARY_PATH before running
symbol-test.
2011-12-31 14:43:55 -04:00
Austin Clements
f4996c3f04 test: Remove #! line from test-lib.sh
It makes no sense to run test-lib.sh, so it makes no sense to give it
an interpreter.  This is particularly annoying for Emacs users who
have executable-insert set, since the presence of the #! line will
cause Emacs to mark test-lib.sh executable when saving it, which will
in turn case the 'basic' test to fail.
2011-12-29 18:03:00 -04:00
Austin Clements
66ecd9063f test: Make generated message date a real date
January 5, 2001 was a Tuesday, not a Friday.  Jameson fixed this exact
problem for the multipart test in ec2b0a98cc, but not for
generate_message itself.

As Jameson pointed out in ec2b0a98cc, if we want to test date parsing,
we should do it separately.
2011-12-29 17:47:21 -04:00
David Bremner
bed6022ed1 test: allow user to choose which emacs to run tests with.
As we start to pay more attention to emacs24, it helps to be able to
select a different version of emacs to run the tests with to verify
version specific bugs.

A separate variable TEST_EMACS is needed to avoid being overwritten by the
make variable EMACS in Makefile.config

For what it's worth, the value of emacs is chosen at the time
tmp.emacs/run_emacs is created, so is fixed for all subtests.
2011-12-28 15:50:04 -04:00
David Edmondson
c96f5f29dd test: Updated the expected output to match the newly enabled text/plain hooks. 2011-12-28 13:29:08 -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
Dmitry Kurochkin
9a0b61da56 test: add test for `notmuch-hello-refresh-hook'
Test that `notmuch-hello-refresh-hook' is called once when
`notmuch-hello' is called and twice when calling
`notmuch-hello-update' after that.

The tests are very similar to tests for `notmuch-hello-mode-hook'.
2011-12-22 06:57:46 -04:00
Dmitry Kurochkin
eb8638ba2e test: add general Emacs hook counter
Replace `notmuch-hello-mode-hook-counter' with general `hook-counter'
and `add-hook-counter' functions to allow counting calls for any hook.
2011-12-22 06:57:32 -04:00
Dmitry Kurochkin
59adb2da19 emacs: do not call `notmuch-hello-mode' on update
`notmuch-hello' should call `notmuch-hello-mode' function only when
run for the first time.  But before the change, `notmuch-hello' used
`kill-all-local-variables' to remove editable widgets fields.  This
caused the major mode to be reset, and `notmuch-hello-mode' to be
called every time.

The patch manually deletes all editable widget fields and removes
`kill-all-local-variables' call.
2011-12-20 07:42:31 -04:00
Dmitry Kurochkin
9928b5b50f test: add broken test for `notmuch-hello-mode-hook' called during update
Test that `notmuch-hello-mode-hook' is not called during
`notmuch-hello' buffer updates.  The test is currently broken.
2011-12-20 07:42:14 -04:00
Dmitry Kurochkin
785028dc2e test: add test for `notmuch-hello-mode-hook'
Test that `notmuch-hello-mode-hook' is called once when
`notmuch-hello' function is called.
2011-12-20 07:42:00 -04:00
Dmitry Kurochkin
33735c28a4 test: add `notmuch-hello-mode-hook-counter'
Add `notmuch-hello-mode-hook-counter' hook to count how many times
`notmuch-hello-mode-hook' was called.  The counter function increments
`notmuch-hello-mode-hook-counter' variable value if it is bount,
otherwise it does nothing.
2011-12-20 07:41:51 -04:00
David Bremner
451c57d19a test: optionally print subtest number
The idea is that $test_count could be used in tests to label
intermediate files. The output enabled by this patch (and --debug)
helps figure out which OUTPUT.nn file belongs to which test in case
several subtests write to OUTPUT.$test_count
2011-12-18 06:33:27 -04:00
Thomas Jost
6dcd575d7b Fix build with binutils-2.22
binutils-2.22 changes the behaviour of ld by defaulting to
--no-copy-dt-needed-entries, which means that required objects/libs are not
"indirectly" linked through intermediate objects/libs anymore. As a consequence,
when using binutils-2.22, building symbol-test fails with the following error:

    /usr/bin/ld: test/symbol-test.o: undefined reference to symbol
    'std::basic_string<char, std::char_traits<char>, std::allocator<char>
    >::~basic_string()@@GLIBCXX_3.4'

    /usr/bin/ld: note: 'std::basic_string<char, std::char_traits<char>,
    std::allocator<char> >::~basic_string()@@GLIBCXX_3.4' is defined in DSO
    /usr/lib/libstdc++.so.6 so try adding it to the linker command line

    /usr/lib/libstdc++.so.6: could not read symbols: Invalid operation

An easy fix is to link using CXX instead of CC.
2011-12-17 21:54:21 -04:00
David Bremner
32e656f473 Revert "test: add emacs test for hiding a message following an HTML part"
This reverts commit c6a3a768fe.

This test is unreliable, showing BROKEN in some environments and FIXED
in others.  The confusion seems to outweigh the benefits, for now.

Conflicts:

	test/emacs
2011-12-15 08:00:08 -04:00
David Bremner
e00aeb4f85 test: add arg-test to .gitignore
This should have been done when the binary was added, oops.
2011-12-12 23:26:06 -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
Thomas Jost
ae13d612c1 test: use python2 instead of python if available
Some distros (Arch Linux) ship Python as python2 and Python 3 as python.
Checking for python2 is necessary for the Python tests to work on these
platforms.
2011-12-11 10:43:16 -04:00
Thomas Jost
2621f6cef1 test: add a function to run Python tests
The new test_python() function makes writing Python tests a little easier:
- it sets the environment variables as needed
- it redirects stdout to the OUTPUT file (like test_emacs()).

This commit also declares python as an external prereq.

The stdout redirection is required to avoid trouble when running commands like
"python 'script' | sort > OUTPUT": in such a case, any error due to a missing
external prereq would be "swallowed" by sort, resulting to a failed test instead
of a skipped one.
2011-12-11 10:40:14 -04:00
Dmitry Kurochkin
5f9e3f6987 test: cleanup gdb external dependency in atomicity tests
Change atomicity tests to use the new external binary dependencies.
This simplifies the code and makes output consistent.
2011-12-11 10:13:32 -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
pazz
e81e3d1bdb test: date_relative in notmuch search json output
expect the date_relative field for thread entries
in notmuch search's json output

note from Commiter: we don't have to worry about the date changing
because the date in question is more than 180 days old.
2011-12-07 21:19:40 -04:00
Dmitry Kurochkin
a647f43643 emacs: do not call notmuch show for non-inlinable parts
Before the change, there was a workaround to avoid notmuch show calls
for parts with application/* Content-Type.  But non-inlinable parts
are not limited to this Content-Type (e.g. mp3 files have audio/mpeg
Content-Type and are not inlinable).  For such parts
`notmuch-show-insert-part-*/*' handler is called which unconditionally
fetches contents for all parts.

The patch moves content fetching from `notmuch-show-insert-part-*/*'
to `notmuch-show-mm-display-part-inline' function after MIME inlinable
checks are done to avoid useless notmuch show calls.  The
application/* hack is no longer needed and removed.
2011-12-07 20:05:25 -04:00
Dmitry Kurochkin
3e0820eb71 test: check that Emacs UI does not call notmuch for non-inlinable parts
The patch adds two new test cases:

* Do not call notmuch for non-inlinable application/mpeg parts
* Do not call notmuch for non-inlinable audio/mpeg parts

The application/mpeg test passes thanks to a workaround for
application/* Content-Types.  The audio/mpeg is currently broken.
2011-12-07 20:03:29 -04:00
Dmitry Kurochkin
e994bb28df test: add functions to count how much times notmuch was called
The patch adds two auxiliary functions and a variable:

  notmuch_counter_reset
  $notmuch_counter_command
  notmuch_counter_value

They allow to count how many times notmuch binary is called.
notmuch_counter_reset() function generates a script that counts how
many times it is called and resets the counter to zero.  The function
sets $notmuch_counter_command variable to the path to the generated
script that should be called instead of notmuch to do the counting.
The notmuch_counter_value() function returns the current counter
value.
2011-12-07 20:03:00 -04:00
David Bremner
1daa7f3e95 test/symbol-hiding: compare exported symbols with existing one
We assume that any symbol starting with notmuch_ in lib/*.o should be
exported, and that only those symbols should be exported.
2011-12-07 19:56:01 -04:00
David Bremner
db17dd46c0 test/symbol-hiding: add some whitespace between tests
This is in preparation for adding a third test to this file
2011-12-07 19:55:47 -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
7bf1f6e85a test: add test-binaries target
The goal here is to have a simple way of making sure all of the
binaries needed to run tests are available.
2011-12-06 09:37:44 -04:00
David Bremner
07bb8b9e89 test/python: set LD_LIBRARY_PATH and PYTHONPATH to use local notmuch
Possibly this should be factored out into some kind of "run_python"
function.
2011-12-05 23:06:50 -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
Dmitry Kurochkin
de3d46e93c test: fix error messages for missing binary dependencies
The fake missing binary functions check if the binary has already be
added to the diagnostic message to avoid duplicates.  Unfortunately,
this check was buggy because the message string does not have the
trailing space.
2011-11-30 17:26:10 -08:00
Dmitry Kurochkin
5635977543 test: fix spurious output from missing external binaries functions
The grep(1) command used in the fake binary functions was missing the
quiet option.
2011-11-30 17:25:24 -08:00
Dmitry Kurochkin
571810f717 test: add missing escape backslash in test_declare_external_prereq() 2011-11-30 17:23:00 -08:00
Dmitry Kurochkin
716e9a45b9 test: fix test_require_external_prereq()
test_missing_external_prereq_${binary}_ variable indicates that the
binary is missing.  It must be set in test_declare_external_prereq()
outside of the fake $binary() function.
2011-11-30 17:22:28 -08:00
Dmitry Kurochkin
6cb61729d4 test: fix "Stashing in notmuch-search" test when emacs is not available
If emacs is not available, test_expect_equal would be called with only
one argument.  The patch fixes this by quoting the (possibly empty)
$(cat OUTPUT) argument.
2011-11-27 11:33:35 -08:00
Dmitry Kurochkin
5af65f65e8 test: check if emacs is available in the beginning of test_emacs
Unfortunately, this is needed to avoid the emacs waiting loop.
2011-11-27 11:33:13 -08:00
Dmitry Kurochkin
f0fbdad04b test: add function to explicitly check for external dependencies
Useful when binary is called indirectly (e.g. from emacs).
2011-11-27 11:32:52 -08:00
Dmitry Kurochkin
d095902266 test: declare external dependencies for the tests
That are: dtach(1), emacs(1), emacsclient(1), gdb(1) and gpg(1).
2011-11-27 11:32:26 -08:00
Dmitry Kurochkin
f325466728 test: skip all subtests if external dependencies are missing during init
Some tests (e.g. crypto) do a common initialization required for all
subtests.  The patch adds a check for missing external dependencies
during this initialization.  If any prerequisites are missing, all
subtests are skipped.

The check is run on the first call of test_reset_state_ function, so
no changes for the tests are needed.
2011-11-27 11:32:11 -08:00
Dmitry Kurochkin
5b37fb1e25 test: fix "skipping test" verbose output 2011-11-27 11:31:46 -08:00
Dmitry Kurochkin
66158d5e40 test: add support for external executable dependencies
There is existing support for general prerequisites in the test suite.
But it is not very convenient to use: every test case has to keep
track for it's dependencies and they have to be explicitly listed.

The patch aims to add better support for a particular type of external
dependencies: external executables.  The main idea is to replace
missing external binaries with shell functions that have the same
name.  These functions always fail and keep track of missing
dependencies for a subtest.  The result reporting functions later can
check that an external binaries are missing and correctly report SKIP
result instead of FAIL.  The primary benefit is that the test cases do
not need to declare their dependencies or be changed in any way.
2011-11-27 11:31:17 -08:00
Dmitry Kurochkin
5aeca8182f test: add test state reset to test_expect_* functions that did not have it 2011-11-27 08:13:52 -08:00
Dmitry Kurochkin
9d5b521472 test: set EMACS_SERVER variable only after dtach(1) was successfully started
Otherwise, we can set the EMACS_SERVER and return with an error.  And
subsequent calls to test_emacs would assume that emacs server is running.
2011-11-27 08:13:07 -08:00
Dmitry Kurochkin
1660ca5e61 test: move subtest variables reset into a dedicated function
Currently, there is only one such variable test_subtest_known_broken_.
But more will be added in the future.
2011-11-27 08:12:41 -08:00
Amadeusz Żołnowski
945196d79b Build symbol-test with make instead of hardcoding in symbol-hiding.
If symbol-test is built in symbol-hiding with hardcoded g++ invokation,
it's not so easy to pass $(srcdir) which is required to find notmuch.h
when srcdir and builddir are separate directories.
2011-11-27 08:03:04 -08:00
David Bremner
ac8576de63 Merge branch 'release' 2011-11-26 21:15:20 -08:00
David Bremner
9756b9dcb9 build system: clean up object files in ./test and ./util 2011-11-26 09:55:07 -08:00
Amadeusz Żołnowski
0da10aa1bc Whitespaces cleanup. 2011-11-26 09:21:04 -08:00
Amadeusz Żołnowski
071456e5e6 Fix warnings for test/symbol-test.cc. 2011-11-26 09:20:47 -08:00
Dmitry Kurochkin
cb9af12a4f test: cleanup basic tests
Basic test 'Ensure that all available tests will be run by
notmuch-test' compares all tests that are run with listing of test/
directory.  There is a growing list of exceptions for files and
directories which located in the test/ directory but are not tests.
Moreover some (probably buggy) tests do create files in the the test/
directory which may be left behind in case of failure.  This makes the
basic test fail.

The patch changes the test to look only for regular executable files.
This makes the exception list much smaller.  And since no tests should
create executables in the test/ directory (if there are, they should
be fixed), the basic test should not be affected by failed or
interrupted tests.
2011-11-26 09:18:05 -08:00
Dmitry Kurochkin
fea2c106ac test: fix sed error in basic tests
The error is easy to miss, because the test passes and stderr is not
printed.  But if you run basic tests in verbose mode (./basic
--verbose), you get:

  sed: can't read notmuch-test: No such file or directory

The issue is that sed command is given two files: notmuch-test and
$TEST_DIRECTORY/notmuch-test.  And there is no notmuch-test file in
the current directory (test/tmp.basic/).  The patch just removes the
non-existing file from the sed command.
2011-11-26 09:17:14 -08:00
Dmitry Kurochkin
bad712e20f test: remove executable permissions from test-lib.sh
It is not supposed to be run, only sourced.
2011-11-26 09:12:14 -08:00
Gregor Zattler
629dbac626 emacs: test notmuch show with fourfold message indentation
Previous behaviour was to indent messages in a thread according
to depth by one space per level.  This commit tests if setting
notmuch-indent-messages-width to `4' provides a message thread
with four spaces of indentation thread depth.
2011-11-25 12:41:59 -05:00
Gregor Zattler
06156f70bf emacs: test: notmuch show without indentation
Previous behaviour was to indent messages in a thread according
to depth by one space per level.  In
id:1311028119-50637-1-git-send-email-fgeller@gmail.com Felix
Geller proposed a patch in order to turn indentation off.  This
commit tests if instead setting notmuch-indent-messages-width to
`0' does turn off indentation.
2011-11-25 12:41:43 -05:00
Gregor Zattler
647635fc9e emacs: test notmuch-indent-messages-width default
Previous behaviour was to indent messages in a thread according
to depth by one space per level.  This is still the case with
notmuch-indent-messages-width default value `1'.  This test
succeeds if output with default value is same as in "Basic
notmuch-show view in emacs".
2011-11-25 12:41:04 -05: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
Florian Friesdorf
cef4075404 fix a double // to single / 2011-11-20 22:55:54 -04: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
Pieter Praet
66247d26f3 test: emacs: tidy up "Stashing in notmuch-show" test
Merge expected output into the actual test, so we can verify the stashed
filename using ${gen_msg_filename} instead of doing sed tricks.
2011-11-18 13:29:35 -05:00
Tomi Ollila
c832dad322 test: attempt to send QUIT to smtp-dummy in case mail send failed
If mail sending from emacs fails before it has chance to connect
to the smtp-dummy mail server, the opportunistic QUIT message
sending makes smtp-dummy to exit.
2011-11-18 10:49:53 -04:00
Tomi Ollila
8efdc0518d test: create dtach's session socket in $TEST_TMPDIR
Due to 108-character limit in unix domain socket path this change
is required; it is more probable that length of ${TMPDIR:-/tmp} is
shorter than length of path to the current directory of notmuch test
source directory. One can expect to create reasonable-length unix
domain sockets wherever $TMPDIR points to.
2011-11-17 19:35:32 -04:00
Tomi Ollila
a0ec104f13 test: create TEST_TMPDIR for holding temporary files
The TEST_TMPDIR if first needed to hold dtach's socket (due
to 108-character limit in socket file names). Later it can be
used to hold other temporary files; directory deleted at exit.
2011-11-17 19:35:32 -04: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
Tomi Ollila
9cda22c39b test/atomicity: change shebang to '#!/usr/bin/env bash' 2011-11-14 17:08:53 -04:00
Thomas Jost
cb7270b27a test: make smtp-dummy work with Emacs 24
In Emacs 24, a space is expected after a SMTP response code. If we don't respect
that, smtpmail-send-it will wait forever.
2011-11-13 13:48:02 -04:00
Dmitry Kurochkin
5964a760a5 test: do not hide test_emacs errors
Do not redirect test_emacs stderr to /dev/null.  Test_emacs uses
emacsclient(1) now and it does not print unwanted messages (like
those from `message') to stderr.  But it does print useful
errors, e.g. when emacs server connection fails, given expression
is not valid or undefined function is called.
2011-11-13 09:44:36 -04:00
Tomi Ollila
085d45e389 exec emacs at the end of run_emacs script
In the last line of run_emacs, exec the emacs process.
With one fork less the process list is (also) neater.
2011-11-12 23:21:44 -04:00
Pieter Praet
64febdf71c test: stashing in notmuch-{show,search}
Should provide full test coverage of the stashing feature.

Signed-off-by: Pieter Praet <pieter@praet.org>
2011-11-12 20:32:47 -04:00
Dmitry Kurochkin
e972d752c0 emacs: add invisible space after the search widget field in notmuch-hello
It is very convenient when C-e (bound to `widget-end-of-line') ignores
trailing spaces inside the search widget.  But it only does so if a
widget is not followed by a newline (that is why it works in the saved
search widgets).  The patch just adds an invisible space after the
search widget to get the desirable behavior of `widget-end-of-line'.
The extra space is also added to expected results of emacs tests.
2011-11-12 10:34:53 -05:00
Tomi Ollila
ac46c6fdc2 smtp-dummy: clear sockaddr_in structure before use in bind()
Any junk bytes in sockaddr_in structure before passing that
to bind() system call may cause problems.
2011-11-12 07:48:00 -05:00
Tomi Ollila
2f2ea8a49a test: use dtach(1) instead of screen(1) in emacs tests
dtach is simpler than screen and is not setuid/setgid program so
TMPDIR does not get cleared by dynamic loader when executed
2011-11-11 18:24:53 -05:00
Dmitry Kurochkin
6e6cb68b80 emacs: improve hidden signatures handling in notmuch-show-advance-and-archive
Use `previous-single-char-property-change' instead of going
through each character by hand and testing it's visibility.  This
fixes `notmuch-show-advance-and-archive' to work for the last
message in thread with hidden signature.
2011-11-07 20:38:37 -04:00
Dmitry Kurochkin
9689656351 test: `notmuch-show-advance-and-archive' with invisible signature
Add Emacs test to check that `notmuch-show-advance-and-archive'
works for the last message in thread with invisible signature.
2011-11-07 20:38:37 -04:00
Dmitry Kurochkin
95cf33cc78 test: do not set frame width in emacs
No need for `set-frame-width' in emacs tests since it runs in
screen now.
2011-11-05 21:55:57 -03:00
Dmitry Kurochkin
746a13e6f4 test: avoid using screen(1) configuration files
Set SCREENRC and SYSSCREENRC environment variables to "/dev/null"
as suggested by Jim Paris to avoid potential problems with
screen(1) configuration files.
2011-11-05 21:54:40 -03:00
Dmitry Kurochkin
a1ea4e914f test: run emacs inside screen
Before the change, emacs run in daemon mode without any visible
buffers.  Turns out that this affects emacs behavior in some
cases.  In particular, `window-end' function returns `point-max'
instead of the last visible position.  That makes it hard or
impossible to implement some tests.  The patch runs emacs in a
detached screen(1) session.  So that it works exactly as if it
has a visible window.

Note: screen terminates when emacs exits.  So the patch does not
introduce new "running processes left behind" issues.
2011-11-05 20:49:27 -03:00
Dmitry Kurochkin
749abb74f2 test: json show format of message with inline attachment with filename
The patch adds a test to check that json show format includes
filenames for attachments with inline disposition.
2011-11-05 20:15:00 -03:00
David Bremner
903fe63986 notmuch-restore: check for extra arguments.
We consider it an error to pass more than one file to restore, since
extra ones are ignored.
2011-10-23 10:27:57 -03:00
David Bremner
a77d9adcac notmuch-restore: implement --accumulate option
Modify command line argument handling to take a --accumulate flag.
Test for extra arguments beyond the input file.

The --accumulate switch causes the union of the existing and new tags to be
applied, instead of replacing each message's tags as they are read in from the
dump file.

Based on a patch by Thomas Schwinge:

      id:"1317317857-29636-1-git-send-email-thomas@schwinge.name"
2011-10-23 10:27:57 -03:00
David Bremner
42c80dfd07 test/dump-restore: add tests for restore --accumulate
Flesh out what ``notmuch restore --accumulate'' is supposed to do.
Its tests are currently XFAILed; the functionality will be added in
future patch(es).

Based on a patch by Thomas Schwinge:

      id:"1317317811-29540-1-git-send-email-thomas@schwinge.name"
2011-10-23 10:27:57 -03:00
David Bremner
8a65353b4f test/dump-restore: Fix quoting on grep
Thanks to Thomas Schwinge for noticing yet another place where quoting
matters. Since the shell translates \. to ., the regex passed to grep
is too generous without the quotes.

The use of [.] is the suggestion of Tomi Ollila.
2011-10-23 10:27:57 -03:00
David Bremner
c457951344 test/dump-restore: expand test suite for dump-restore, make more robust
Several new tests are added, and existing use of test_begin_subtest is
replaced by test_expect_success to catch failing commands in cases where
we execute more than one command.

Based on changes in

      id:"1317317811-29540-1-git-send-email-thomas@schwinge.name"
2011-10-22 19:43:02 -03:00
David Bremner
f4148e9d21 test/test-lib.sh: update comments
- explain test_expect_equal_file
- remove mention of test_expect_failure, since that function was removed.

Based on id:"1317317811-29540-1-git-send-email-thomas@schwinge.name"
2011-10-22 19:43:02 -03:00
David Bremner
53b397acfc notmuch-dump: deprecate use of output file argument.
We print an intentionally non-specific message on stderr, since it
isn't clear if there will be some global output file argument to
replace.

We update the test suite atomically, since it relies on having the
same text in two files.
2011-10-16 19:59:53 -03:00
David Bremner
09beff1def notmuch-dump: treat any remaining arguments after the filename as search terms
The main motivation here is allow the fast dumping of tag data for
messages having certain tags.  In practice it seems too slow to pipe
dump to grep.

All dump-restore tests should be working now, so we update test/dump-restore
accordingly
2011-10-16 19:59:53 -03:00
David Bremner
532829d463 test: add tests for command line arguments to notmuch-dump
The plan is to add the possibility of search terms after the file name,
and the use of -- to stop looking for an output file name.
2011-10-16 19:59:53 -03:00
David Bremner
adb1dc6792 test: update dump-restore to use redirection instead of filename args
The idea here is that we want to deprecate the use of arguments to
dump and restore to specify paths, since in particular we want to use
the non-option arguments to dump to form a query.
2011-10-12 18:01:12 -03:00
Jameson Graef Rollins
808fbff530 test: add two emacs tests for show mode refresh
The first test tests that the notmuch-show-refresh-view function
produces the exact same output for an unmodified show buffer.  This
test should pass since the relevant functionality has already been
applied.

The second test tests show refresh for a show buffer that has been
modified by navigation and message visibility toggling.  Ideally
refresh-view should preserve this state of the notmuch-show buffer.
Unfortunately it currently does not, so this test is know to be broken
and is marked as such.
2011-10-09 08:26:08 -03:00
Jameson Graef Rollins
5d21d5ea0c test: test for absence of "Non-text part: application/pgp-*" lines in reply
In reply, the quoted text does not need to mention that the original
message had "application/pgp-signed" or "application/pgp-encrypted"
parts.
2011-10-06 10:13:20 -03:00
Jameson Graef Rollins
a53422fedc test/multipart: test for absence of "Non-text part:" lines in reply for multipart/* and message/rfc822 parts
There's no reason to output "Non-text part:" lines for parts that are
not leaf nodes, eg. multipart/* and message/rfc822.  We fix the text
here to test for their absence.  The next patch will fix reply
accordingly.
2011-10-06 10:12:28 -03:00
David Bremner
2697f623ae test/atomicity: redirect output from "which"
Without redirection, this produced some slightly confusing output in
case gdb was present.
2011-09-25 09:12:48 -03:00
David Bremner
c468f3703e test: make atomicity setup conditional on gdb being present.
The setup is useless if gdb is not present, so it doesn't hurt to skip
it.  The diff here is huge, but the commit is really just moving most
of the script inside the initial if, and adding an else block to print
a warning.
2011-09-24 22:45:33 -03:00
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