"test_expect_emacs_t" expects a single argument. If this is `t' then the test passes. Otherwise the argument provides the details of the test failure to be reported. --- For use in the following set of tests and later for other emacs related tests. test/test-lib.sh | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index d1fbc05..0ffe9a6 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -503,6 +503,26 @@ test_expect_equal_file () fi } +# Pass test if the result is `t', else report the results. +test_expect_emacs_t () +{ + exec 1>&6 2>&7 # Restore stdout and stderr + inside_subtest= + test "$#" = 1 || + error "bug in the test script: not 1 parameter to test_expect_emacs_t" + + result="$1" + if ! test_skip "$test_subtest_name" + then + if [ "${result}" == "t" ] ; then + test_ok_ "$test_subtest_name" + else + testname=$this_test.$test_count + test_failure_ "$test_subtest_name" "$(eval printf ${result})" + fi + fi +} + NOTMUCH_NEW () { notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file' -- 1.7.7.3