Am 20.11.2015 um 21:50 schrieb René Scharfe:
Extract a helper function for searching for a pattern in a file and
printing the whole file if the pattern is not found. It is useful
when starting tests with --verbose for debugging purposes.
+# Check if a file contains an expected pattern.
+test_must_contain () {
+ if grep "$1" "$2"
+ then
+ return 0
+ else
+ echo "didn't find /$1/ in '$2', it contains:"
+ cat "$2"
+ return 1
+ fi
+}
There is already test_i18n_grep. Should it be folded into this function?
Wouldn't we also want to have a function test_must_not_contain?
IMHO, we should not increase the number of functions that give a bonus
only when there is a test case failure. They do not scale well: There is
a permanent mental burden on every reviewer to watch out that they are
used in new tests. But without those functions, the burden is on the one
person investigating a test case failure, who has to live without the
debugging support.
-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html