]> git.notmuchmail.org Git - notmuch/blobdiff - test/test-lib.sh
tests: Test against source man pages.
[notmuch] / test / test-lib.sh
index 791d2dc668e05dde0a0c4e5828db1dea8988e2b6..f34b1fb86af15eb89b91c328e2558d0f0eb8207b 100644 (file)
@@ -497,17 +497,17 @@ test_expect_equal_file ()
        test "$#" = 2 ||
        error "bug in the test script: not 2 or 3 parameters to test_expect_equal"
 
        test "$#" = 2 ||
        error "bug in the test script: not 2 or 3 parameters to test_expect_equal"
 
-       output="$1"
-       expected="$2"
+       file1="$1"
+       file2="$2"
        if ! test_skip "$test_subtest_name"
        then
        if ! test_skip "$test_subtest_name"
        then
-               if diff -q "$expected" "$output" >/dev/null ; then
+               if diff -q "$file1" "$file2" >/dev/null ; then
                        test_ok_ "$test_subtest_name"
                else
                        testname=$this_test.$test_count
                        test_ok_ "$test_subtest_name"
                else
                        testname=$this_test.$test_count
-                       cp "$output" $testname.output
-                       cp "$expected" $testname.expected
-                       test_failure_ "$test_subtest_name" "$(diff -u $testname.expected $testname.output)"
+                       cp "$file1" "$testname.$file1"
+                       cp "$file2" "$testname.$file2"
+                       test_failure_ "$test_subtest_name" "$(diff -u "$testname.$file1" "$testname.$file2")"
                fi
     fi
 }
                fi
     fi
 }
@@ -1070,6 +1070,7 @@ find_notmuch_path ()
 # Test the binaries we have just built.  The tests are kept in
 # test/ subdirectory and are run in 'trash directory' subdirectory.
 TEST_DIRECTORY=$(pwd)
 # Test the binaries we have just built.  The tests are kept in
 # test/ subdirectory and are run in 'trash directory' subdirectory.
 TEST_DIRECTORY=$(pwd)
+notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
 if test -n "$valgrind"
 then
        make_symlink () {
 if test -n "$valgrind"
 then
        make_symlink () {
@@ -1130,11 +1131,15 @@ then
        PATH=$GIT_VALGRIND/bin:$PATH
        GIT_EXEC_PATH=$GIT_VALGRIND/bin
        export GIT_VALGRIND
        PATH=$GIT_VALGRIND/bin:$PATH
        GIT_EXEC_PATH=$GIT_VALGRIND/bin
        export GIT_VALGRIND
+       test -n "$notmuch_path" && MANPATH="$notmuch_path/man:$MANPATH"
 else # normal case
 else # normal case
-       notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
-       test -n "$notmuch_path" && PATH="$notmuch_path:$PATH"
+       if test -n "$notmuch_path"
+               then
+                       PATH="$notmuch_path:$PATH"
+                       MANPATH="$notmuch_path/man:$MANPATH"
+               fi
 fi
 fi
-export PATH
+export PATH MANPATH
 
 # Test repository
 test="tmp.$(basename "$0" .sh)"
 
 # Test repository
 test="tmp.$(basename "$0" .sh)"