aboutsummaryrefslogtreecommitdiff
path: root/make/tests/common.mk
blob: 55b931db87a0c87514aa15094816b52f8a622eba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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))))