Don't use 'git' to do comparison for tests

This commit is contained in:
K. Lange 2021-02-23 14:01:55 +09:00
parent 617c1e8eec
commit 7df8c0803f
2 changed files with 5 additions and 2 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/*.exe
/*.deb
/krk-*
/test/*.actual
# I typically clone these subprojects in the root as well.
/wasm/
/jupyter/

View File

@ -116,10 +116,12 @@ tags: $(wildcard src/*.c) $(wildcard src/*.h)
# Test targets run against all .krk files in the test/ directory, writing
# stdout to `.expect` files, and then comparing with `git`.
# To update the tests if changes are expected, run `make test` and commit the result.
.PHONY: test stress-test
.PHONY: test stress-test update-tests
test:
@for i in test/*.krk; do echo $$i; KUROKO_TEST_ENV=1 $(TESTWRAPPER) ./kuroko $$i > $$i.actual; diff $$i.expect $$i.actual || exit 1; rm $$i.actual; done
update-tests:
@for i in test/*.krk; do echo $$i; KUROKO_TEST_ENV=1 $(TESTWRAPPER) ./kuroko $$i > $$i.expect; done
@git diff --exit-code test/*.expect
# You can also set TESTWRAPPER to other things to run the tests in other tools.
stress-test: