Commit graph

615 commits

Author SHA1 Message Date
Peter Wang
9a64b2df29 test: test insert --create-folder option
Add tests for notmuch insert --create-folder option.
2013-07-04 00:08:16 -03:00
Peter Wang
0c4b8aa736 test: test insert --folder option
Add tests for notmuch insert --folder option.
2013-07-01 12:23:09 -03:00
Peter Wang
7e3a7ed62f test: add tests for insert
Add tests for new 'insert' command.
2013-06-29 19:29:02 -03:00
Austin Clements
43251ab653 emacs: Use S-exp format everywhere
This switches `notmuch-mua-reply' and `notmuch-query-get-threads' to
the S-exp format.  These were the last two uses of the JSON format in
the Emacs frontend.
2013-06-24 22:57:13 -07:00
Tomi Ollila
8d863c9e87 revert: Removed top level --stderr= option
While looked good on paper, its attempted use caused confusion, complexity,
and potential for information leak when passed through wrapper scripts.
For slimmer code and to lessen demand for maintenance/support the set of
commits which added top level --stderr= option is now reverted.
2013-06-24 22:52:59 -07:00
Tomi Ollila
2593df5271 test/basic: replaced find -perm +111 with portable alternative
The find option syntax `-perm +111` is deprecated gnu find feature.
The replacement `( -perm -100 -o -perm -10 -o -perm 1 )` should also
work outside of the GNU domain.
2013-06-24 22:49:51 -07:00
Austin Clements
89efd5717a emacs: Use streaming S-expr parser for search
In addition to being the Right Thing to do, this noticeably improves
the time taken to display the first page of search results, since it's
roughly an order of magnitude faster than the JSON parser.
Interestingly, it does *not* significantly improve the time to
completely fill a large search buffer because for large search
buffers, the cost of creating author invisibility overlays and
inserting text (which slows down with more overlays) dominates.
However, the time required to display the first page of results is
generally more important to the user experience.
2013-06-01 09:00:40 -03:00
Austin Clements
08fde50bf3 emacs: Use async process helper for search
Previously, search started the async notmuch process directly.  Now,
it uses `notmuch-start-notmuch'.  This simplifies the process sentinel
a bit and means that we no longer have to worry about errors
interleaved with the JSON output.

We also update the tests of Emacs error handling, since the error
output is now separated from the search results buffer.
2013-06-01 08:56:16 -03:00
Austin Clements
7eaf698e23 test: Remove extraneous Emacs error handling test
We now check error handling more carefully in the last test in
test/emacs and we're about to add more error handling tests.  (This
was also a strange place for this test, since it had nothing to do
with large search buffers.)
2013-06-01 08:53:19 -03:00
Austin Clements
1546387d72 emacs: Simplify MIME part command implementation
This unifies the part button actions and the underlying part action
functions into single interactive command that simply applies to the
part containing point using the just-added part p-list text property
instead of button properties.  Since all part actions can be performed
by applying the appropriate mm function to an mm-handle, this patch
abstracts out the creation of mm handles, making the implementations
of the part commands trivial.  This also eliminates our special
handling for part save in favor of using the appropriate mm function.

This necessarily modifies the way we handle the default part button
action, but in a way that does not change the meaning of the
notmuch-show-part-button-default-action defcustom.

Since these commands are no longer specific to buttons, this patch
eliminates the extra metadata stored with each button.  This also
eliminates one rather special-purpose macro for a collection of
general purpose part handling utilities.
2013-05-31 22:01:02 -03:00
Tomi Ollila
ff598e4fdd test: added --stderr=FILE tests
--stderr=FILE tests were added to test/help-test as it is the one
doing most global option testing. Also, it was simplest to test
this new option using `notmuch help` command.
2013-05-29 20:01:38 -03:00
Peter Wang
42102e0b3f test: add tests for search --exclude=all
Test the new search --exclude=all option.
2013-05-13 21:32:46 -03:00
Aaron Ecay
cf8aaafbad lib/database.cc: change how the parent of a message is calculated
Presently, the code which finds the parent of a message as it is being
added to the database assumes that the first Message-ID-like substring
of the In-Reply-To header is the parent Message ID.  Some mail clients,
however, put stuff other than the Message-ID of the parent in the
In-Reply-To header, such as the email address of the sender of the
parent.  This can fool notmuch.

The updated algorithm prefers the last Message ID in the References
header.  The References header lists messages oldest-first, so the last
Message ID is the parent (RFC2822, p. 24).  The References header is
also less likely to be in a non-standard
syntax (http://cr.yp.to/immhf/thread.html,
http://www.jwz.org/doc/threading.html).  In case the References header
is not to be found, fall back to the old behavior.

V2 of this patch, incorporating feedback from Jani and (indirectly)
Austin.
2013-05-13 21:29:13 -03:00
Aaron Ecay
983d5e1df2 test: add tests for the handling of References and In-Reply-To headers
These tests are known_broken, the following commit fixes them.

amended per

	id:87txmi1zq3.fsf@nikula.org
	id:87vc6yalo7.fsf@zancas.localnet
2013-05-13 21:27:01 -03:00
Jani Nikula
9641fe1ce7 cli: config: fix config file save when the file does not exist
The use of realpath(3) in
commit 58ed67992d
Author: Jani Nikula <jani@nikula.org>
Date:   Sun Apr 7 20:15:03 2013 +0300

    cli: config: do not overwrite symlinks when saving config file

broke config file save when the file does not exist, which results in
'notmuch setup' always failing to create a new config file.

Fix by checking ENOENT from realpath(3).
2013-05-12 07:46:44 -03:00
Jani Nikula
2c64c2e0eb test: add basic test for notmuch setup
And annotate with test_subtest_known_broken. Hooray.
2013-05-12 07:46:23 -03:00
Jani Nikula
58ed67992d cli: config: do not overwrite symlinks when saving config file
Use realpath to canonicalize the config path before writing.

Previously 'notmuch setup' and 'notmuch config set' overwrote the
config file even if it was a symbolic link.
2013-04-14 18:38:07 -03:00
Jani Nikula
7defbcdcec test: add some config file tests
Test the --config=FILE option, and add a broken test for writing
config file through a symbolic link.
2013-04-14 18:35:02 -03:00
Jani Nikula
360c3c8607 test: notmuch count --batch and --input options 2013-04-01 09:38:48 -04:00
Jani Nikula
6b405143d7 test: notmuch tag --remove-all 2013-03-30 18:34:22 -04:00
Jani Nikula
e76f6517de cli: config: make notmuch_config_open() "is new" parameter input only
We now have a notmuch_config_is_new() function to query whether a
config was created or not. Change the notmuch_config_open() is_new
parameter into boolean create_new to determine whether the function
should create a new config if one doesn't exist. This reduces the
complexity of the API.
2013-03-07 09:39:12 -04:00
Aaron Ecay
ed5150d2df test/README: mention the test_expect_equal_json and *sanitize* functions
also fix one typo
2013-03-07 09:38:26 -04:00
David Bremner
16aa65ba25 Merge branch 'release'
add in NEWS from 0.15.2

Conflicts:
	NEWS
2013-02-18 20:33:48 -04:00
Tomi Ollila
0d8d11d338 test/test-lib.sh: separate signaled exit
When execution of tests is interrupted by signal coming outside of the
test system itself, output just one line "interrupted by signal <num>"
message to standard output. This distinguishes the case from internal
exit and reduces noise.
2013-02-18 20:17:17 -04:00
Tomi Ollila
3a15602d8e test/test-lib.sh: use $test_subtest_name in all tests
Set the variable '$test_subtest_name' in all functions which starts
a new test and use that variable in all functions that output
test results.

Additionally output the latest '$test_subtest_name' in case of
abnormal exit, to avoid confusion.
2013-02-18 20:17:05 -04:00
David Bremner
f021a06288 test: delay watchdog checks in emacs.
Instead of checking immediately for the watched process, delay a
minute, or in the case that process-attributes returns nil, for two
minutes.  This is intended to cope with the case that
process-attributes is unimplimented, and returns always returns nil.
In this case, the watchdog check is the same as the two minute limit
imposed by timeout.
2013-01-29 19:17:07 -04:00
Tomi Ollila
a12f810a00 test/test-lib.sh: use vt100 as dtach terminal if TERM dumb or unset/empty
The TERM environment variable is set to 'dumb' when running tests, but
the original value of it is stored for echoing colors and running emacs
(somewhat interactively) in detached session. Emacs requires some
terminal control sequences to be available for interactive operation.
In case original TERM is (also) 'dumb' (or unset/empty) emacs cannot
run interactively. To fix this problem dtach (and emacs as it's child
process) is run with TERM=vt100 in case original TERM was unset, empty
or 'dumb'. This way there is a chance to run emacs tests with different
user terminals and potentially find problems there.
2013-01-24 06:59:21 -04:00
David Bremner
bd829fde96 test/tagging: add test for naked punctuation in tags; compare with quoting spaces.
This test also serves as documentation of the quoting
requirements. The comment lines are so that it exactly matches the man
page. Nothing more embarrassing than having an example in the man page
fail.
2013-01-07 20:49:00 -04:00
David Bremner
bbdbc83854 test/tagging: add test for exotic message-ids and batch tagging
The (now fixed) bug that this test revealed is that unquoted
message-ids with whitespace or other control characters in them are
split into several tokens by the Xapian query parser.
2013-01-07 20:49:00 -04:00
David Bremner
9a31cbd386 test/tagging: add tests for exotic tags
We test quotes seperately because they matter to the query escaper.
2013-01-07 20:49:00 -04:00
David Bremner
e77a99f44e test/tagging: add basic tests for batch tagging functionality
This tests argument parsing, blank lines and comments, and basic hex
decoding functionality.
2013-01-07 20:49:00 -04:00
David Bremner
45c593095b test/tagging: add test for error messages of tag --batch
This is based on the similar test for notmuch restore, but the parser
in batch tagging mode is less tolerant of a few cases, in particular
those tested by illegal_tag.
2013-01-07 20:49:00 -04:00
Austin Clements
401dbebd48 emacs: Use the minibuffer for CLI error reporting
We recently switched to popping up a buffer to report CLI errors, but
this was too intrusive, especially for transient errors and especially
since we made fewer things ignore errors.  This patch changes this to
display a basic error message in the minibuffer (using Emacs' usual
error handling path) and, if there are additional details, to log
these to a separate error buffer and reference the error buffer from
the minibuffer message.  This is more in line with how Emacs typically
handles errors, but makes the details available to the user without
flooding them with the details.

Given this split, we pare down the basic message and make it more
user-friendly, and also make the verbose message even more detailed
(and more debugging-oriented).
2013-01-06 22:47:35 -04:00
Austin Clements
425e2bc812 dump/restore: Use Xapian queries for batch-tag format
This switches the new batch-tag format away from using a home-grown
hex-encoding scheme for message IDs in the dump to simply using Xapian
queries with Xapian quoting syntax.

This has a variety of advantages beyond presenting a cleaner and more
consistent interface.  Foremost is that it will dramatically simplify
the quoting for batch tagging, which shares the same input format.
While the hex-encoding is no better or worse for the simple ID queries
used by dump/restore, it becomes onerous for general-purpose queries
used in batch tagging.  It also better handles strange cases like
"id:foo and bar", since this is no longer syntactically valid.
2013-01-06 22:40:32 -04:00
Austin Clements
d08c714b6a dump: Disallow \n in message IDs
When we switch to using regular Xapian queries in the dump format, \n
will cause problems, so we disallow it.  Specially, while Xapian can
quote and parse queries containing \n without difficultly, quoted
queries containing \n still span multiple lines, which breaks the
line-orientedness of the dump format.  Strictly speaking, we could
still round-trip these, but it would significantly complicate restore
as well as scripts that deal with tag dumps.  This complexity would
come at absolutely no benefit: because of the RFC 2822 unfolding
rules, no amount of standards negligence can produce a message with a
message ID containing a line break (not even Outlook can do it!).

Hence, we simply disallow it.
2013-01-06 22:40:01 -04:00
David Bremner
d705a6a45b notmuch-restore: handle empty input file, leading blank lines and comments.
This patch corrects several undesirable behaviours:

1) Empty files were not detected, leading to buffer read overrun.

2) An initial blank line cause restore to silently abort

3) Initial comment line caused format detection to fail
2013-01-06 10:04:19 -04:00
David Bremner
4dea9bb442 test/dump-restore: new tests for empty files and leading comments/whitespace.
Three of these are marked broken; the third is a regression test,
since it passes by virtue of batch-tag being the default input format.
2013-01-06 09:35:41 -04:00
Jani Nikula
b98e890456 test: notmuch search --format=text0 2012-12-18 17:04:17 -04:00
Peter Wang
732f50a20a test: conform to content length, encoding fields
Update tests to expect content-length and content-transfer-encoding
fields in show --format=json output, for leaf parts with omitted body
content.
2012-12-17 09:11:57 -04:00
Peter Wang
ee425ae2ad test: normalize only message filenames in show json
notmuch_json_show_sanitize replaced "filename" field values even in part
structures, where the value is predictable.  Make it only normalize the
filename value if it is an absolute path (begins with slash), which is
true of the Maildir filenames that were intended to be normalized away.
2012-12-17 09:08:04 -04:00
Austin Clements
2cdb3f54f7 emacs: Use --format-version for search, show, and reply 2012-12-16 17:22:26 -04:00
Austin Clements
e723e21f75 test: Sanity tests for the --format-version argument 2012-12-16 17:21:49 -04:00
Austin Clements
1e12b91b3c test: Test search's handling of subprocess errors 2012-12-16 17:17:58 -04:00
Austin Clements
19e5b2d912 emacs: Use unified error handling in search
This slightly changes the output of an existing test since we now
report non-zero exits with a pop-up buffer instead of at the end of
the search results.
2012-12-16 17:17:41 -04:00
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