chiark / gitweb /
subdirmk: Merge new version and fix everything
[secnet.git] / subdirmk / tests / filter / update-expected
diff --git a/subdirmk/tests/filter/update-expected b/subdirmk/tests/filter/update-expected
new file mode 100755 (executable)
index 0000000..b9c79e7
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# subdirmk - part of the test suite
+#  Copyright 2019 Mark Wooding
+#  Copyright 2019 Ian Jackson
+# SPDX-License-Identifier: LGPL-2.0-or-later
+# There is NO WARRANTY.
+#
+# Usual approach to updating the expected outputs is
+#   tests/filter/check
+#   tests/filter/update-expected
+#   selectively git-add the things that are right, after inspecting them
+
+set -e
+files=$(find tests/filter -name \*.expected.tmp)
+for f in $files; do
+       perl -pe '
+               (s/\n//, $stripnl=0) if $stripnl;
+               next unless /^# doctests start/../^# doctests end/;
+               $_="";
+               $stripnl=1;
+       ' \
+               <${f%.expected.tmp}.tmp >${f%.tmp}
+done