shithub: rgbds

Download patch

ref: bddd5bc678064f0fdf3ce18942ecb6c6bed4b208
parent: f6b7e39ce7fc91f5e0320719625bae86761c09cc
author: Jakub Kądziołka <[email protected]>
date: Thu Aug 29 16:23:50 EDT 2019

test/asm: Generate .out.pipe files on the fly

--- a/test/asm/test.sh
+++ b/test/asm/test.sh
@@ -9,11 +9,21 @@
 	for variant in '' '.pipe'; do
 		if [ -z "$variant" ]; then
 			../../rgbasm -o $o $i > $after 2>&1
+			desired_output=${i%.asm}.out
 		else
+			# Stop! This is not a Useless Use Of Cat. Using cat instead of
+			# stdin redirection makes the input an unseekable pipe - a scenario
+			# that's harder to deal with and was broken when the feature was
+			# first implemented.
 			cat $i | ../../rgbasm -o $o - > $after 2>&1
+
+			# Escape regex metacharacters
+			desired_output=$before
+			subst="$(printf '%s\n' "$i" | sed 's:[][\/.^$*]:\\&:g')"
+			sed "s/$subst/-/g" ${i%.asm}.out > $desired_output
 		fi
 
-		diff -u ${i%.asm}.out$variant $after
+		diff -u $desired_output $after
 		rc=$(($? || $rc))
 		bin=${i%.asm}.out.bin
 		if [ -f $bin ]; then