diff --git a/.gitignore b/.gitignore index 191cadc..26f7d66 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ transform.tex Dockerfile.tex intro.tex Makefile.tex +tests.tex +tests.mk diff --git a/Makefile b/Makefile index 0ce459c..91f2f01 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,6 @@ MKFILES+= pkg.mk pub.mk transform.mk MKFILES+= tex.mk doc.mk MKFILES+= noweb.mk haskell.mk MKFILES+= exam.mk results.mk -#MKFILES+= miun.port.mk - -MIUNFILES+= miun.docs.mk miun.tex.mk miun.subdir.mk -MIUNFILES+= miun.package.mk miun.pub.mk miun.course.mk -MIUNFILES+= miun.export.mk miun.results.mk latexmkrc -MIUNFILES+= miun.depend.mk OTHERS+= latexmkrc OTHERS+= gitattributes @@ -17,7 +11,6 @@ OTHERS+= Dockerfile .PHONY: all all: makefiles.pdf all: ${MKFILES} -#all: ${MIUNFILES} all: ${OTHERS} makefiles.pdf: makefiles.tex preamble.tex makefiles.bib @@ -26,6 +19,7 @@ makefiles.pdf: exam.bib makefiles.pdf: transform.bib makefiles.pdf: tex.bib makefiles.pdf: Dockerfile.tex +makefiles.pdf: tests.tex define makefiles_depends makefiles.pdf: $(1:.mk=.tex) $(1) $(1:.mk=.tex): $(1).nw @@ -46,11 +40,11 @@ docker-makefiles: Dockerfile push: docker-makefiles docker push ${DOCKER_ID_USER}/makefiles -PKG_PACKAGES?= main -PKG_NAME-main= makefiles +PKG_PACKAGES?= main +PKG_NAME-main= makefiles -PKG_PREFIX= /usr/local -PKG_INSTALL_DIR= /include +PKG_PREFIX= /usr/local +PKG_INSTALL_DIR= /include PKG_INSTALL_FILES-main= ${MKFILES} PKG_TARBALL_FILES-main= ${PKG_INSTALL_FILES-main} ${OTHERS} Makefile README.md @@ -64,6 +58,7 @@ clean: ${RM} ${MKFILES:.mk=.tex} ${RM} gitattributes Dockerfile ${RM} makefiles.tar.gz + ${RM} tests.mk distclean: docker image rm makefiles @@ -73,3 +68,7 @@ MAKEFILES_INCLUDE=${INCLUDE_MAKEFILES} include ${MAKEFILES_INCLUDE}/tex.mk include ${MAKEFILES_INCLUDE}/noweb.mk include ${MAKEFILES_INCLUDE}/pkg.mk +tests.mk: tests.nw $(addsuffix .nw,${MKFILES}) + ${NOTANGLE} + +include tests.mk diff --git a/Makefile.nw b/Makefile.nw index e44c573..9653f34 100644 --- a/Makefile.nw +++ b/Makefile.nw @@ -71,6 +71,7 @@ makefiles.pdf: exam.bib makefiles.pdf: transform.bib makefiles.pdf: tex.bib makefiles.pdf: Dockerfile.tex +makefiles.pdf: tests.tex @ We must add the generated files to the clean recipe. <>= ${RM} makefiles.pdf @@ -175,3 +176,19 @@ all: makefiles.tar.gz ${RM} makefiles.tar.gz @ +\section{Testing all functionality} + +Finally, we provide tests in [[tests.mk]]. +This file is tangled from all parts of the framework. +To use it, we must include it in the [[Makefile]]. +<>= +tests.mk: tests.nw $(addsuffix .nw,${MKFILES}) + ${NOTANGLE} + +include tests.mk +@ This also requires +<>= +${RM} tests.mk +@ + +\input{tests.tex} diff --git a/tests.nw b/tests.nw new file mode 100644 index 0000000..da82352 --- /dev/null +++ b/tests.nw @@ -0,0 +1,35 @@ +We now provide the details of [[tests.mk]], which will test all functionality +of this framework and will thus be interesting for illustrating a variety of +the framework's use. + +We provide a [[test]] target that will run all tests, each test will be a +dependency for [[test]]. +The target [[test-clean]] will clean up. +(The [[clean]] target will depend on [[test-clean]] so that it will +automatically be run when [[clean]] is run.) +Finally, [[run-tests]] will depend on any tests defined throughout the +framework. + +All tests will be run in a subdirectory [[tests]]. +The [[test]] target will set this up and start executing [[run-tests]] in that +directory. +<>= +.PHONY: test +test: + ${MKDIR} tests + ${MAKE} -C tests -f ../tests.mk run-tests + +.PHONY: clean test-clean +test-clean: + ${RM} tests + +clean: test-clean + +.PHONY: run-tests +run-tests: + true +@ + +Now, each NOWEB source file of the framework can define a [[<>]] code +block that will be appended to [[<>]] here (thanks to the recipe for +[[tests.mk]] in [[Makefile]]).