]> Sergey Matveev's repositories - zsh-autoenv.git/blob - Makefile
Fix tests: match $CRAMTMP more losely (#78)
[zsh-autoenv.git] / Makefile
1 # Default, can be overridden using "make test ZDOTDIR=...".
2 ZDOTDIR:=${CURDIR}/tests/ZDOTDIR
3
4 # Export it, and make it absolute.
5 override export ZDOTDIR:=$(abspath $(ZDOTDIR))
6
7 TEST_SHELL:=zsh
8
9 test:
10         cram --shell=$(TEST_SHELL) -v tests
11
12 itest:
13         cram -i --shell=$(TEST_SHELL) tests
14
15 # Run tests with all ZDOTDIRs.
16 test_full:
17         for zsh in zsh /opt/zsh-4.3.9/bin/zsh; do \
18                 command -v $$zsh || { echo "Skipping non-existing shell: $$zsh"; continue; }; \
19                 ret=0; \
20                 for i in $(wildcard tests/ZDOTDIR*); do \
21                         echo "zsh=$zsh ZDOTDIR=$$i"; \
22                         SHELL=$$zsh ZDOTDIR=${CURDIR}/$$i cram --shell=$$zsh -v tests || ret=$$?; \
23                         echo; \
24                 done; \
25         done; \
26         exit $$ret
27
28 # Define targets for test files, with relative and abolute path.
29 # Use verbose output, which is useful with Vim's 'errorformat'.
30 TESTS:=$(wildcard tests/*.t)
31
32 uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
33 _TESTS_REL_AND_ABS:=$(call uniq,$(abspath $(TESTS)) $(TESTS))
34 $(_TESTS_REL_AND_ABS):
35         cram --shell=$(TEST_SHELL) -v $@
36 .PHONY: $(_TESTS_REL_AND_ABS)
37
38 .PHONY: itest test
39
40 clean:
41         $(RM) tests/*.err