diff options
| author | Joel Martin <github@martintribe.org> | 2014-03-24 16:32:24 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-03-24 16:32:24 -0500 |
| commit | 3169070063b2cb877200117ebb384269d73bcb93 (patch) | |
| tree | 23de3db1ea5c37afd21a45b6ed7771f56a08c0c4 /make/tests/common.mk | |
| download | mal-3169070063b2cb877200117ebb384269d73bcb93.tar.gz mal-3169070063b2cb877200117ebb384269d73bcb93.zip | |
Current state of mal for Clojure West lighting talk.
Diffstat (limited to 'make/tests/common.mk')
| -rw-r--r-- | make/tests/common.mk | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/make/tests/common.mk b/make/tests/common.mk new file mode 100644 index 0000000..55b931d --- /dev/null +++ b/make/tests/common.mk @@ -0,0 +1,18 @@ + +# assert macros +assert = $(if $1,,$(error assert failure: $2)) +assert_not = $(if $1,$(error assert_not: $2),) +assert_eq = $(if $(call _EQ,$(1),$(2)),,$(error assert_eq failure: $(1) != $(2): $(3))) +# With debug: +#assert_eq = $(info 1: $(1))$(info 2: $(2))$(info 3: $(3))$(if $(call _EQ,$(1),$(2)),,$(error assert_eq failure: $(3))) + + +# REPL related wrappers +test_read = $(call READ_STR,$(1)) +ifndef MACROEXPAND +define MACROEXPAND +$(1) +endef +endif +test_re = $(strip $(call EVAL,$(call MACROEXPAND,$(strip $(call test_read,$(1))),$(REPL_ENV)),$(REPL_ENV))) +test_rep = $(call PRINT,$(strip $(call EVAL,$(call MACROEXPAND,$(strip $(call test_read,$(1))),$(REPL_ENV)),$(REPL_ENV)))) |
