chiark / gitweb /
Legal: Update tests/filter/ inputs and outputs
[subdirmk.git] / tests / filter / update-expected
index ff105423fa427ffe1d68836c36fe76735f4fb9f9..b9c79e72a5f86335698f35e788b458a5ccffc203 100755 (executable)
@@ -1,4 +1,9 @@
 #!/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
@@ -6,5 +11,13 @@
 #   selectively git-add the things that are right, after inspecting them
 
 set -e
-files=$(find tests/filter -name \*.tmp)
-for f in $files; do cp $f ${f%.tmp}.expected; done
+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