aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2012-10-27emacs: Introduce generic boolean term escaping functionAustin Clements
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-27tag: Disallow adding malformed tags to messagesAustin Clements
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-22notmuch-show: include Bcc header in json outputMichal Nazarewicz
With this change, emacs users can use notmuch-message-headers variable to configure notmuch-show display Bcc header.
2012-10-22test: new: Fix intermittent test failures with --debugEthan Glasser-Camp
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-20test/test-lib.sh: take the --background feature in smtp-dummy into useTomi Ollila
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-20test/smtp-dummy: add --background option and functionalityTomi Ollila
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-20test: another test wrt ignoring user-specified files and directoriesPieter Praet
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-20test-lib.sh: pass 'NOTMUCH_NEW's args down to 'notmuch new'Pieter Praet
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-20emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers'Pieter Praet
* 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-20test: emacs: new tests "notmuch-show: {, un}collapse all messages in thread"Pieter Praet
* 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-20test: emacs: new tests "notmuch-show: {show, hide} message headers"Pieter Praet
* 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-18test: Move tests from emacs to emacs-showEthan Glasser-Camp
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-18test: handle filenames that have directories in themEthan Glasser-Camp
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-17test: emacs: toggle thread content indentation in `notmuch-show'Pieter Praet
See commit c205e8ff.
2012-10-17test: emacs: toggle eliding of non-matching messages in `notmuch-show'Pieter Praet
See commits 44a544ed, 866ce8b1, 668b66ec.
2012-10-17test: emacs: toggle eliding of non-matching messages in `notmuch-show'Pieter Praet
See commits 44a544ed, 866ce8b1, 668b66ec. Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
2012-09-30test: Add a test for HTML email with inline imagesAustin Clements
Currently this test passes in Emacs 23 but fails in Emacs 24 (at least on some Linux distributions).
2012-09-30test: Clear test-output output file before running Emacs testsAustin Clements
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-01test/atomicity: use a more portable 'cp' formMike Kelly
-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-01test/basic: use portable args for findMike Kelly
`-executable` isn't available in FreeBSD's version of find, so use a more portable version, `-perm +111`.
2012-09-01tests: Test against source man pages.Mike Kelly
Without this, help-test tests against the installed man pages, rather than the default ones.
2012-09-01test/smtp-dummy.c: fix compilation on FreeBSDMike Kelly
Use the more portable netint/in.h, instead of netint/ip.h, to include htons(3), etc.
2012-09-01test/Makefile.local: Use $(XAPIAN_LDFLAGS) for symbol-testMike Kelly
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-01test: make test_expect_equal_file() arguments flexibleDmitry Kurochkin
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-08-30test: use (format "%S") to print nil in emacs test.David Bremner
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-30test: canonicalize content-type in "Sending a message via (fake) SMTP"David Bremner
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-29test: emacs: run list-processes after accept-process-output in emacs 23.1Tomi Ollila
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-29test: emacs: call accept-process-output in notmuch-test-waitTomi Ollila
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-12sprinters: bugfix when NULL passed for a string.Mark Walters
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-12test: Add test for messages with missing headersAustin Clements
Currently the JSON tests for search and show are broken because notmuch attempts to dereference a NULL pointer.
2012-08-06notmuch-restore: replace positional argument for input with optionDavid Bremner
Since notmuch dump doesn't use positional arguments anymore, it seems better to be consistent.
2012-08-06notmuch-dump: remove deprecated positional argument for output fileDavid Bremner
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-03test: Remove unnecessary JSON canonicalizationAustin Clements
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-03test: Uniformly canonicalize actual and expected JSONAustin Clements
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-02build system: remove directories created by tests in "make clean"David Bremner
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-07-24test: add tests for the new --body=true|false optionMark Walters
2012-07-24Use the structured formatters in notmuch-search.c.craven@gmx.net
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-12emacs: Switch from text to JSON format for search resultsAustin Clements
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-12test: New test for incremental search output parsingAustin Clements
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-09test: add basic show, search --format=text testsPeter Wang
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-06-10lib: Treat messages in new/ as maildir messages with no flags setAustin Clements
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-10test: Add broken test for tag synchronization on files delivered to new/Austin Clements
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-07emacs: only strip "re:" in the beginning of subjectJani Nikula
Fix notmuch-show-strip-re by matching "re:" only in the beginning of the input string.
2012-06-07test: add test for emacs notmuch-show-strip-re functionJani Nikula
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-05-25test: remove "Testing" from test description in emacs-hello and emacs-showDmitry Kurochkin
"Testing" is printed by test/test-lib.sh, so having "Testing" in test description results in duplicate "Testing" in console output.
2012-05-24test: add tests for notmuch reply From guessingJani Nikula
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-24new: Centralize file type stat-ing logicAustin Clements
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-24test: Test notmuch new with a broken symlinkAustin Clements
2012-05-23python: Remove find_message_by_filename workaroundAustin Clements
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-06emacs: fix custom queries section customization widget in notmuch-helloDmitry Kurochkin
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.