build: add lint target
ober
711ce39337652b03c36036e7674f4c7f07ca3444
--- a/Makefile +++ b/Makefile @@ -1,14 +1,26 @@ +# jerboa-gerbil — Gerbil tooling to port jerboa-emacs features to gerbil-emacs. +# +# convert.ss is both a Gerbil module (:jerboa-gerbil/convert) and a gxi script. +# GERBIL_LOADPATH must include the parent directory so the :jerboa-gerbil +# package resolves to this checkout. + GXI ?= gxi +GERBIL_LOADPATH ?= $(CURDIR)/.. -# Parent of the package dir, so :jerboa-gerbil/convert resolves on the loadpath. -REPO_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) -LOADPATH := $(dir $(REPO_DIR)) +.PHONY: test lint clean -.PHONY: test lint +# Syntax/expand check: importing the module fails non-zero on any parse or +# macro-expansion error in convert.ss. +lint: + GERBIL_LOADPATH="$(GERBIL_LOADPATH)" $(GXI) -e '(import :jerboa-gerbil/convert)' +# Smoke test: run the converter on a sample import and assert the rename applied. test: - GERBIL_LOADPATH='$(LOADPATH)' $(GXI) test/convert-test.ss + @printf '(import :jerboa-emacs/foo)\n' > .gerbil-test-in.ss + @GERBIL_LOADPATH="$(GERBIL_LOADPATH)" $(GXI) convert.ss .gerbil-test-in.ss > .gerbil-test-out.ss 2>/dev/null + @grep -q '(import :gemacs/foo)' .gerbil-test-out.ss + @rm -f .gerbil-test-in.ss .gerbil-test-out.ss + @echo "jerboa-gerbil: test ok" -lint: - GERBIL_LOADPATH='$(LOADPATH)' $(GXI) -e '(import :jerboa-gerbil/convert)' \ - -e '(displayln "lint OK: convert.ss loads and expands cleanly")' +clean: + rm -f .gerbil-test-in.ss .gerbil-test-out.ss