diff --git a/CMakeLists.txt b/CMakeLists.txt index 36d8dc85..cb6863c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,19 @@ check_failure( ARGUMENTS -f does_not_exist /dev/null ) +file(GLOB fail_compile_INPUTS test/fail_compile/*.tas) +foreach(case ${fail_compile_INPUTS}) + + file(RELATIVE_PATH basename ${CMAKE_CURRENT_SOURCE_DIR}/test/fail_compile/ ${case}) + check_failure( + NAME "fail_compile_${basename}" + EXPECT "syntax error|bailing|use before definition|Error|attempted" + COMMAND tas + ARGUMENTS ${case} + ) + +endforeach() + check_failure( NAME "early end of file" EXPECT "End of file unexpectedly reached" diff --git a/test/Makefile b/test/Makefile index 82f7f7fc..0fd1f38d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -6,25 +6,15 @@ CPPFLAGS += -I$(TOP)/lib vpath %.tas $(TOP)/lib -vpath %.tas pass_compile/ fail_compile/ +vpath %.tas pass_compile/ get_obj_name = $(notdir $(patsubst %.tas,%.to,$1)) PASS_ASSEMBLE := $(call get_obj_name,$(wildcard pass_compile/*)) -FAIL_ASSEMBLE := $(call get_obj_name,$(wildcard fail_compile/*)) -# Force re-assembly of assembly-failure tests -.PHONY: $(FAIL_ASSEMBLE) clean_FILES += *.to *.texe clean_FILES += ops/*.texe -all: positive negative +all: positive positive: $(PASS_ASSEMBLE) -negative: $(FAIL_ASSEMBLE) - -$(filter %.to,$(FAIL_ASSEMBLE)): %.to: %.tas - @$(MAKESTEP) -n "Assembling `printf %-24s '$@'` (should fail) ... " - @(! $(tas) -o$@ $< 2>/dev/null) \ - && $(MAKESTEP) "failed as expected" \ - || ($(MAKESTEP) "succeeded unexpectedly" ; false)