Added basic argument check on flow templates.
All checks were successful
Run test asserts / Test-Asserts (push) Successful in -3s

This commit is contained in:
Willem Cazander 2024-07-07 23:45:25 +02:00
parent 8a07c9de8d
commit 5f26a4588d
4 changed files with 45 additions and 15 deletions

View file

@ -8,10 +8,7 @@ MB_PROJ_PHASE_TEST_DEPS += $(1)/@assert-$(2)
.PHONY: $(1)/@assert-$(2) .PHONY: $(1)/@assert-$(2)
endef endef
define mb_assert_flow_grep_binary define mb_assert_flow_grep_binary
$(if $(1),,$(error Argument 1 missing)) $(call mb_make_call,mb_make_check_args_4,mb_assert_flow_grep_binary,$(1),$(2),$(3),$(4))
$(if $(2),,$(error Argument 2 missing))
$(if $(3),,$(error Argument 3 missing))
$(if $(4),,$(error Argument 4 missing))
$(eval $(call mb_make_call,__mb_assert_flow_grep_binary,$(1),$(2),$(3),$(4))) $(eval $(call mb_make_call,__mb_assert_flow_grep_binary,$(1),$(2),$(3),$(4)))
endef endef
$(call mb_make_call,mb_doc_function_flow,mb_assert_flow_grep_binary,"Prints flow of single binary grep assert.","<build-dir> <test-id> <file> <grep-match>") $(call mb_make_call,mb_doc_function_flow,mb_assert_flow_grep_binary,"Prints flow of single binary grep assert.","<build-dir> <test-id> <file> <grep-match>")
@ -29,10 +26,7 @@ MB_PROJ_PHASE_TEST_DEPS += $(1)-test-$(2)/@assert
.PHONY: $(1)-test-$(2)/@assert .PHONY: $(1)-test-$(2)/@assert
endef endef
define mb_assert_flow_bdos_grep define mb_assert_flow_bdos_grep
$(if $(1),,$(error mb_assert_flow_bdos_grep: Argument 1 missing)) $(call mb_make_call,mb_make_check_args_4,mb_assert_flow_bdos_grep,$(1),$(2),$(3),$(4))
$(if $(2),,$(error Argument 2 missing))
$(if $(3),,$(error Argument 3 missing))
$(if $(4),,$(error Argument 4 missing))
$(eval $(call mb_make_call,__mb_assert_flow_bdos_grep,$(1),$(2),$(3),$(4))) $(eval $(call mb_make_call,__mb_assert_flow_bdos_grep,$(1),$(2),$(3),$(4)))
endef endef
$(call mb_make_call,mb_doc_function_flow,mb_assert_flow_bdos_grep,"Prints flow of single grep assert.","<build-dir> <test-id> <cmd-name> <grep-match>") $(call mb_make_call,mb_doc_function_flow,mb_assert_flow_bdos_grep,"Prints flow of single grep assert.","<build-dir> <test-id> <cmd-name> <grep-match>")

View file

@ -100,6 +100,46 @@ endef
$(call mb_make_call,mb_doc_function_flow,mb_make_flow_0module,"Prints flow of recursive 0module.mk include.","<dir>") $(call mb_make_call,mb_doc_function_flow,mb_make_flow_0module,"Prints flow of recursive 0module.mk include.","<dir>")
define mb_make_check_args_1
$(if $(2),,$(error $(1): Argument 1 missing))
endef
$(call mb_make_call,mb_doc_function_deep,mb_make_check_args_1,"Checks that a function has a given argument.","<function> <arg1>")
define mb_make_check_args_2
$(if $(2),,$(error $(1): Argument 1 missing))
$(if $(3),,$(error $(1): Argument 2 missing))
endef
$(call mb_make_call,mb_doc_function_deep,mb_make_check_args_2,"Checks that a function has the given arguments.","<function> <arg1>")
define mb_make_check_args_3
$(if $(2),,$(error $(1): Argument 1 missing))
$(if $(3),,$(error $(1): Argument 2 missing))
$(if $(4),,$(error $(1): Argument 3 missing))
endef
$(call mb_make_call,mb_doc_function_deep,mb_make_check_args_3,"Checks that a function has the given arguments.","<function> <arg1>")
define mb_make_check_args_4
$(if $(2),,$(error $(1): Argument 1 missing))
$(if $(3),,$(error $(1): Argument 2 missing))
$(if $(4),,$(error $(1): Argument 3 missing))
$(if $(5),,$(error $(1): Argument 4 missing))
endef
$(call mb_make_call,mb_doc_function_deep,mb_make_check_args_4,"Checks that a function has the given arguments.","<function> <arg1>")
define mb_make_check_args_5
$(if $(2),,$(error $(1): Argument 1 missing))
$(if $(3),,$(error $(1): Argument 2 missing))
$(if $(4),,$(error $(1): Argument 3 missing))
$(if $(5),,$(error $(1): Argument 4 missing))
$(if $(6),,$(error $(1): Argument 5 missing))
endef
$(call mb_make_call,mb_doc_function_deep,mb_make_check_args_5,"Checks that a function has the given arguments.","<function> <arg1>")
define mb_make_echo_good define mb_make_echo_good
$(if $(filter -1,$(MB_OS_COLORS)),@echo $(MB_MAKE_ECHO_CRAYON) $(1),$(MB_OS_ECHO) -e "\x1B[32m$(MB_MAKE_ECHO_CRAYON)$$1\x1B[39m $(1)") $(if $(filter -1,$(MB_OS_COLORS)),@echo $(MB_MAKE_ECHO_CRAYON) $(1),$(MB_OS_ECHO) -e "\x1B[32m$(MB_MAKE_ECHO_CRAYON)$$1\x1B[39m $(1)")
endef endef

View file

@ -193,7 +193,7 @@ $$(call mb_make_call,mb_doc_target_help,@package-deploy,"Deploy all the packages
.PHONY: @package-deploy .PHONY: @package-deploy
endef endef
define mb_proj_flow_setup define mb_proj_flow_setup
$(if $(1),,$(error $(1) missing)) $(call mb_make_call,mb_make_check_args_1,mb_proj_flow_setup,$(1))
$(eval $(call mb_make_call,__mb_proj_flow_setup,$(1))) $(eval $(call mb_make_call,__mb_proj_flow_setup,$(1)))
endef endef
$(call mb_make_call,mb_doc_function_flow,mb_proj_flow_setup,"Prints flow of abstract project build cycle.","<build-dirs>") $(call mb_make_call,mb_doc_function_flow,mb_proj_flow_setup,"Prints flow of abstract project build cycle.","<build-dirs>")

View file

@ -44,9 +44,7 @@ $$(call mb_make_call,mb_doc_target_run,$(1)/@run,"Run $(3).com manually with gui
.PHONY: $(1)/@run .PHONY: $(1)/@run
endef endef
define mb_tool_m80_flow_bdos_mono define mb_tool_m80_flow_bdos_mono
$(if $(1),,$(error Argument 1 missing)) $(call mb_make_call,mb_make_check_args_3,mb_tool_m80_flow_bdos_mono,$(1),$(2),$(3))
$(if $(2),,$(error Argument 2 missing))
$(if $(3),,$(error Argument 3 missing))
$(eval $(call mb_make_call,__mb_tool_m80_flow_bdos_mono,$(1),$(2),$(3))) $(eval $(call mb_make_call,__mb_tool_m80_flow_bdos_mono,$(1),$(2),$(3)))
endef endef
$(call mb_make_call,mb_doc_function_flow,mb_tool_m80_flow_bdos_mono,"Prints flow of m80 toolchain bdos mono file module.","<bin-dir> <src-dir> <objname>") $(call mb_make_call,mb_doc_function_flow,mb_tool_m80_flow_bdos_mono,"Prints flow of m80 toolchain bdos mono file module.","<bin-dir> <src-dir> <objname>")
@ -88,9 +86,7 @@ $$(call mb_make_call,mb_doc_target_run,$(1)/@run,"Run $(3).com manually with gui
.PHONY: $(1)/@run .PHONY: $(1)/@run
endef endef
define mb_tool_sdcc_flow_bdos_mono define mb_tool_sdcc_flow_bdos_mono
$(if $(1),,$(error Argument 1 missing)) $(call mb_make_call,mb_make_check_args_3,mb_tool_sdcc_flow_bdos_mono,$(1),$(2),$(3))
$(if $(2),,$(error Argument 2 missing))
$(if $(3),,$(error Argument 3 missing))
$(eval $(call mb_make_call,__mb_tool_sdcc_flow_bdos_mono,$(1),$(2),$(3))) $(eval $(call mb_make_call,__mb_tool_sdcc_flow_bdos_mono,$(1),$(2),$(3)))
endef endef
$(call mb_make_call,mb_doc_function_flow,mb_tool_sdcc_flow_bdos_mono,"Prints flow of sdcc toolchain bdos mono file module.","<bin-dir> <src-dir> <objname>") $(call mb_make_call,mb_doc_function_flow,mb_tool_sdcc_flow_bdos_mono,"Prints flow of sdcc toolchain bdos mono file module.","<bin-dir> <src-dir> <objname>")