X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.sh;h=078f0602ad72792fb5fe3d6f7cdc378bb25e83c4;hp=533d15b5e8388d5b03652aab9b624123f36c4526;hb=18967ef7506566c3b7b5332893a3876da051ca5d;hpb=5297b361d1c5c7dd62b80da0327c091e4c23b140 diff --git a/test/test-lib.sh b/test/test-lib.sh index 533d15b5..078f0602 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright (c) 2005 Junio C Hamano # @@ -441,6 +441,29 @@ test_expect_equal () fi } +test_expect_equal_file () +{ + exec 1>&6 2>&7 # Restore stdout and stderr + inside_subtest= + test "$#" = 3 && { prereq=$1; shift; } || prereq= + test "$#" = 2 || + error "bug in the test script: not 2 or 3 parameters to test_expect_equal" + + output="$1" + expected="$2" + if ! test_skip "$@" + then + if diff -q "$expected" "$output" >/dev/null ; then + test_ok_ "$test_subtest_name" + else + testname=$this_test.$test_count + mv "$output" $testname.output + mv "$expected" $testname.expected + test_failure_ "$test_subtest_name" "$(diff -u $testname.expected $testname.output)" + fi + fi +} + test_expect_equal_failure () { exec 1>&6 2>&7 # Restore stdout and stderr @@ -479,6 +502,12 @@ notmuch_show_sanitize () { sed -e "$NOTMUCH_SHOW_FILENAME_SQUELCH" } +notmuch_show_sanitize_all () +{ + sed \ + -e 's| filename:.*| filename:XXXXX|' \ + -e 's| id:[^ ]* | id:XXXXX |' +} # End of notmuch helper functions