aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test-lib.el
Commit message (Collapse)AuthorAge
* test: New tests for Emacs charset handlingGravatar Austin Clements2014-09-21
| | | | | | The test of viewing 8bit messages is known-broken. The rest pass, but for very fragile reasons. The next several commits will fix the known-broken test and make our charset handling robust.
* test/emacs: globally force the html renderer to html2textGravatar David Bremner2014-09-21
| | | | | | Previously we did this for a single test, but some other proposed tests ( id:1398105468-14317-3-git-send-email-amdragon@mit.edu ) show similar breakage when switching renderers.
* test: make test_emacs call post-command-hookGravatar David Bremner2014-07-13
| | | | | | | | | | | | | | The unread/read changes will use the post-command-hook. test_emacs does not call the post-command-hook. This adds a notmuch-test-progn which takes a list of commands as argument and executes them in turn but runs the post-command-hook after each one. The caller can batch operations (ie to stop post-command-hook from being interleaved) by wrapping the batch of operations inside a progn. We also explicitly run the post-command-hook before getting the output from a test; this makes sense as this will be a place the user would be seeing the information.
* emacs: show: mark tags changed since buffer loadedGravatar Mark Walters2014-03-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows (and requires) the original-tags to be passed along with the current-tags to be passed to notmuch-tag-format-tags. This allows the tag formatting to show added and deleted tags.By default a removed tag is displayed with strike-through in red (if strike-through is not available, eg on a terminal, inverse video is used instead) and an added tag is displayed underlined in green. If the caller does not wish to use the new feature it can pass current-tags for both arguments and, at this point, we do exactly that in the three callers of this function. Note, we cannot tidily allow original-tags to be optional because we would need to distinguish nil meaning "we are not specifying original-tags" from nil meaning there were no original-tags (an empty list). We use this in subsequent patches to make it clear when a message was unread when you first loaded a show buffer (previously the unread tag could be removed before a user realised that it had been unread). The code adds into the existing tag formatting code. The user can specify exactly how a tag should be displayed normally, when deleted, or when added. Since the formatting code matches regexps a user can match all deleted tags with a ".*" in notmuch-tag-deleted-formats. For example setting notmuch-tag-deleted-formats to '((".*" nil)) tells notmuch not to show deleted tags at all. All the variables are customizable; however, more complicated cases like changing the face depending on the type of display will require custom lisp. Currently this overrides notmuch-tag-deleted-formats for the tests setting it to '((".*" nil)) so that they get removed from the display and, thus, all tests still pass.
* test/emacs: replace the use of process-attributes with signal-processGravatar David Bremner2014-01-12
| | | | | | | | | | In some environments (at least Hurd), process-attributes is unimplimented and always returns nil. This ends up causing test failures (see e.g. id:87a9ffofsc.fsf@zancas.localnet). Historically and according to POSIX 1003.1-2001, a signal of 0 can be used to check the validity of a pid. This seems less heinous than parsing the output of ps(1).
* test: delay watchdog checks in emacs.Gravatar David Bremner2013-01-29
| | | | | | | | | 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.
* test: Test buttonization of id: linksGravatar Austin Clements2012-11-15
| | | | | | | 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.
* 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.
* 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: `notmuch-test-run' should protect against buffer switching.Gravatar David Edmondson2012-01-26
| | | | | | 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.
* test: `visible-buffer-substring' should not return text properties.Gravatar David Edmondson2012-01-26
| | | | | When using `visible-buffer-substring' to examine a buffer, the text properties are not useful, so don't include them.
* test: Add more helpers for emacs tests.Gravatar David Edmondson2012-01-25
|
* test: Add `test_emacs_expect_t'.Gravatar David Edmondson2012-01-25
| | | | | | | | | 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.
* test: make (kill-emacs) from emacsclient work with emacs 23.(1|2)Gravatar Tomi Ollila2012-01-22
| | | | | | | 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.
* test: add test for `notmuch-hello-refresh-hook'Gravatar Dmitry Kurochkin2011-12-22
| | | | | | | | 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'.
* test: add general Emacs hook counterGravatar Dmitry Kurochkin2011-12-22
| | | | | Replace `notmuch-hello-mode-hook-counter' with general `hook-counter' and `add-hook-counter' functions to allow counting calls for any hook.
* test: add `notmuch-hello-mode-hook-counter'Gravatar Dmitry Kurochkin2011-12-20
| | | | | | | 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.
* test: do not set frame width in emacsGravatar Dmitry Kurochkin2011-11-05
| | | | | No need for `set-frame-width' in emacs tests since it runs in screen now.
* test: use emacsclient(1) for Emacs testsGravatar Dmitry Kurochkin2011-06-28
| | | | | | | | | | | | | | | | | Before the change, every Emacs test ran in a separate Emacs instance. Starting Emacs many times wastes considerable time and it gets worse as the test suite grows. The patch solves this by using a single Emacs server and emacsclient(1) to run multiple tests. Emacs server is started on the first test_emacs call and stopped when test_done is called. We take care not to leave orphan Emacs processes behind when test is terminated by whatever reason: Emacs server runs a watchdog that periodically checks that the test is still running. Some tests need to provide user input. Before the change, this was done using echo(1) to Emacs stdin. This no longer works and instead `standard-input' variable is set accordingly to make `read' return the appropriate string.
* test: save buffer content to file instead of printing it in Emacs testsGravatar Dmitry Kurochkin2011-06-28
| | | | | | | | | | | | | | | | | | | | | | Before the change, the common Emacs test scheme was to print buffer content to stdout and redirect it to a file or capture it in a shell variable. This does not work if we switch to using emacsclient(1) for running the tests, because you can not print to the stdout in this case. (Actually, you can print to stdout from Emacs server, but you can not capture the output on emacsclient(1)). The patch introduces new Emacs test auxiliary functions: `test-output' and `test-visible-output'. These functions are used to save buffer content to a file directly from Emacs. For most tests the changes are trivial, because Emacs stdout output was redirected to a file anyway. But some tests captured the output in a shell variable and compare it with the expected output using test_expect_equal. These tests are changed to use files and test_expect_equal_file instead. Note: even if we do not switch Emacs tests to emacsclient(1), the patch makes tests cleaner and is an improvement.
* test: cleanup test_emacsGravatar Dmitry Kurochkin2011-06-28
| | | | | Move auxiliary function definition and configuration from command line to test-lib.el.
* test: add test-lib.el file with `visible-buffer-string' functionGravatar Dmitry Kurochkin2011-05-26
The patch adds test-lib.el file for Emacs tests auxiliary stuff. Currently, it implements two functions: `visible-buffer-string' and `visible-buffer-substring'. These are similar to standard counterparts without "visible-" prefix but exclude invisible text. The functions are not used anywhere at the moment but should be useful for testing hiding/showing in the Emacs interface. Edited-by: Carl Worth <cworth@cworth.org> Fixed "basic" test to ignore new test-lib.el file.