This is a barebones testing harness that uses a Makefile to set up tests on arbitrary scripts. This is relatively rudimentary, but I can can see a use for it to test simple CLI tools.
The Makefile itself is magical/incomprehensible. I didn’t realize Make was capable of being dynamic at this level.
It looks for
scriptname.test files, executes them, and compares
I’m not entirely sure why this uses
git diff over plain
rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $2,$d)) .PHONY: test test: $(patsubst %.test,%.stdout,$(call rwildcard,,%.test)) %.stdout: %.test ./$< > $@ 2> $(patsubst %.stdout,%.stderr,$@) \ || (touch --date=@0 $@; false) git diff --exit-code --src-prefix=expected/ --dst-prefix=actual/ \ $@ $(patsubst %.stdout,%.stderr,$@) \ || (touch --date=@0 $@; false)