From 3169070063b2cb877200117ebb384269d73bcb93 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Mon, 24 Mar 2014 16:32:24 -0500 Subject: Current state of mal for Clojure West lighting talk. --- make/tests/common.mk | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 make/tests/common.mk (limited to 'make/tests/common.mk') 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)))) -- cgit v1.2.3