aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
Commit message (Collapse)AuthorAge
* test: add tests for date:since..until range queriesGravatar Jani Nikula2012-10-31
| | | | A brief initial test set.
* test: add smoke tests for the date/time parser moduleGravatar Jani Nikula2012-10-31
| | | | | | | | 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.
* test: add new test tool parse-time for date/time parserGravatar Jani Nikula2012-10-31
| | | | | | | | 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.
* emacs: Introduce generic boolean term escaping functionGravatar Austin Clements2012-10-27
| | | | | | | 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.
* tag: Disallow adding malformed tags to messagesGravatar Austin Clements2012-10-27
| | | | | | | | | | | | 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.
* notmuch-show: include Bcc header in json outputGravatar Michal Nazarewicz2012-10-22
| | | | | With this change, emacs users can use notmuch-message-headers variable to configure notmuch-show display Bcc header.
* test: new: Fix intermittent test failures with --debugGravatar Ethan Glasser-Camp2012-10-22
| | | | | | | | | | | | | 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>
* test/test-lib.sh: take the --background feature in smtp-dummy into useGravatar Tomi Ollila2012-10-20
| | | | | | | | | | | | | | 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.
* test/smtp-dummy: add --background option and functionalityGravatar Tomi Ollila2012-10-20
| | | | | | | | | | | | 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.
* test: another test wrt ignoring user-specified files and directoriesGravatar Pieter Praet2012-10-20
| | | | | | | | 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>
* test-lib.sh: pass 'NOTMUCH_NEW's args down to 'notmuch new'Gravatar Pieter Praet2012-10-20
| | | | | | | 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.
* emacs: rename `notmuch-show-toggle-headers' to ↵Gravatar Pieter Praet2012-10-20
| | | | | | | | | | | | | | | | | | | | | | | | `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)"
* test: emacs: new tests "notmuch-show: {, un}collapse all messages in thread"Gravatar Pieter Praet2012-10-20
| | | | | | | | | | | | * 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.
* test: emacs: new tests "notmuch-show: {show, hide} message headers"Gravatar Pieter Praet2012-10-20
| | | | | | | | | | | | | | | | | | | * 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'.
* test: Move tests from emacs to emacs-showGravatar Ethan Glasser-Camp2012-10-18
| | | | | | | | | | | | | | | | | | | | | 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>
* test: handle filenames that have directories in themGravatar Ethan Glasser-Camp2012-10-18
| | | | | | | | 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>
* test: emacs: toggle thread content indentation in `notmuch-show'Gravatar Pieter Praet2012-10-17
| | | | See commit c205e8ff.
* test: emacs: toggle eliding of non-matching messages in `notmuch-show'Gravatar Pieter Praet2012-10-17
| | | | See commits 44a544ed, 866ce8b1, 668b66ec.
* test: emacs: toggle eliding of non-matching messages in `notmuch-show'Gravatar Pieter Praet2012-10-17
| | | | | | See commits 44a544ed, 866ce8b1, 668b66ec. Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
* test: Add a test for HTML email with inline imagesGravatar Austin Clements2012-09-30
| | | | | Currently this test passes in Emacs 23 but fails in Emacs 24 (at least on some Linux distributions).
* test: Clear test-output output file before running Emacs testsGravatar Austin Clements2012-09-30
| | | | | | | | | | | | 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.
* test/atomicity: use a more portable 'cp' formGravatar Mike Kelly2012-09-01
| | | | | | | | -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
* test/basic: use portable args for findGravatar Mike Kelly2012-09-01
| | | | | `-executable` isn't available in FreeBSD's version of find, so use a more portable version, `-perm +111`.
* tests: Test against source man pages.Gravatar Mike Kelly2012-09-01
| | | | | Without this, help-test tests against the installed man pages, rather than the default ones.
* test/smtp-dummy.c: fix compilation on FreeBSDGravatar Mike Kelly2012-09-01
| | | | | Use the more portable netint/in.h, instead of netint/ip.h, to include htons(3), etc.
* test/Makefile.local: Use $(XAPIAN_LDFLAGS) for symbol-testGravatar Mike Kelly2012-09-01
| | | | | | 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.
* test: make test_expect_equal_file() arguments flexibleGravatar Dmitry Kurochkin2012-09-01
| | | | | | | | | | | | | | | | | | | | | | | 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.
* test: use (format "%S") to print nil in emacs test.Gravatar David Bremner2012-08-30
| | | | | | | | 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.
* test: canonicalize content-type in "Sending a message via (fake) SMTP"Gravatar David Bremner2012-08-30
| | | | | | | 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.
* test: emacs: run list-processes after accept-process-output in emacs 23.1Gravatar Tomi Ollila2012-08-29
| | | | | | | | | | | | | | 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.
* test: emacs: call accept-process-output in notmuch-test-waitGravatar Tomi Ollila2012-08-29
| | | | | | | | 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.
* sprinters: bugfix when NULL passed for a string.Gravatar Mark Walters2012-08-12
| | | | | | | | | | | | 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.
* test: Add test for messages with missing headersGravatar Austin Clements2012-08-12
| | | | | Currently the JSON tests for search and show are broken because notmuch attempts to dereference a NULL pointer.
* notmuch-restore: replace positional argument for input with optionGravatar David Bremner2012-08-06
| | | | | Since notmuch dump doesn't use positional arguments anymore, it seems better to be consistent.
* notmuch-dump: remove deprecated positional argument for output fileGravatar David Bremner2012-08-06
| | | | | | 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.
* test: Remove unnecessary JSON canonicalizationGravatar Austin Clements2012-08-03
| | | | | | 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.
* test: Uniformly canonicalize actual and expected JSONGravatar Austin Clements2012-08-03
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* build system: remove directories created by tests in "make clean"Gravatar David Bremner2012-08-02
| | | | | | | | | 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.
* test: add tests for the new --body=true|false optionGravatar Mark Walters2012-07-24
|
* Use the structured formatters in notmuch-search.c.Gravatar craven@gmx.net2012-07-24
| | | | | | | | | | 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.
* emacs: Switch from text to JSON format for search resultsGravatar Austin Clements2012-07-12
| | | | | | | | | | | | | | | | | | | | | | | | | | 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"
* test: New test for incremental search output parsingGravatar Austin Clements2012-07-12
| | | | | | | | | 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.
* test: add basic show, search --format=text testsGravatar Peter Wang2012-07-09
| | | | | | 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.
* lib: Treat messages in new/ as maildir messages with no flags setGravatar Austin Clements2012-06-10
| | | | | | | | | | | | 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.
* test: Add broken test for tag synchronization on files delivered to new/Gravatar Austin Clements2012-06-10
| | | | | | | | | | | | | | | | | 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.
* emacs: only strip "re:" in the beginning of subjectGravatar Jani Nikula2012-06-07
| | | | | Fix notmuch-show-strip-re by matching "re:" only in the beginning of the input string.
* test: add test for emacs notmuch-show-strip-re functionGravatar Jani Nikula2012-06-07
| | | | | | 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.
* test: remove "Testing" from test description in emacs-hello and emacs-showGravatar Dmitry Kurochkin2012-05-25
| | | | | "Testing" is printed by test/test-lib.sh, so having "Testing" in test description results in duplicate "Testing" in console output.
* test: add tests for notmuch reply From guessingGravatar Jani Nikula2012-05-24
| | | | | | | 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>
* new: Centralize file type stat-ing logicGravatar Austin Clements2012-05-24
| | | | | | | | | | 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).