diff options
author | David Edmondson <dme@dme.org> | 2012-01-24 16:14:05 +0000 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2012-01-25 07:25:44 -0400 |
commit | 260975e8aff635b6b99db835ee8d40ec33ee916c (patch) | |
tree | 05cee5def71b7130da493278126a6a76d4919b46 /test/test-lib.sh | |
parent | 2903b32f79dcf7789a2b015c48194cb40ac71462 (diff) |
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.
Diffstat (limited to 'test/test-lib.sh')
-rw-r--r-- | test/test-lib.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh index 82c686ca..81583284 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -503,6 +503,35 @@ test_expect_equal_file () fi } +test_emacs_expect_t () { + test "$#" = 2 && { prereq=$1; shift; } || prereq= + test "$#" = 1 || + error "bug in the test script: not 1 or 2 parameters to test_emacs_expect_t" + + # Run the test. + if ! test_skip "$test_subtest_name" + then + test_emacs "(notmuch-test-run $1)" >/dev/null + + # Restore state after the test. + exec 1>&6 2>&7 # Restore stdout and stderr + inside_subtest= + + # Report success/failure. + result=$(cat OUTPUT) + if [ "$result" = t ] + then + test_ok_ "$test_subtest_name" + else + test_failure_ "$test_subtest_name" "${result}" + fi + else + # Restore state after the (non) test. + exec 1>&6 2>&7 # Restore stdout and stderr + inside_subtest= + fi +} + NOTMUCH_NEW () { notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file' |