382382 || return 1
383383}
384384
385+ # ###################################################################################################
386+ # Issue #142: Non-targets with special characters (e.g. error-if-blank parentheses) do not suppress subsequent targets.
387+ # ###################################################################################################
388+
389+ function when_target_prerequisite_has_special_characters {
390+ local test_case_name=${FUNCNAME[0]}
391+ local actual_value_filename=${test_case_name} .actual.log
392+ bmakelib.test.cat << 'EOF ' > Makefile
393+ SHELL := /usr/bin/env bash
394+ include $(bmakelib.ROOT)/bmakelib.mk
395+
396+ MY_VAR ?= test-val
397+
398+ libscid.configure : bmakelib.error-if-blank( MY_VAR ) ## Configure libscid build
399+ @echo "configuring"
400+
401+ libscid.build : ## Build libscid
402+ @echo "building"
403+ EOF
404+
405+ make bmakelib.conf.help.scope=local bmakelib.conf.help.variables=no bmakelib.conf.help.tips=no help > $actual_value_filename 2>&1
406+
407+ local expexted_pattern_filename=${test_case_name} .expected.pattern
408+ bmakelib.test.cat << 'EOF ' > $expexted_pattern_filename
409+ make.+Entering.+
410+ ={80}
411+ LOCAL: defined inside the source tree
412+ ={80}
413+
414+ TARGETS
415+ libscid\.build\s+Build libscid
416+ libscid\.configure\s+Configure libscid build
417+
418+ make.+Leaving.+
419+ EOF
420+
421+ bmakelib.test.assert_matches $test_case_name $actual_value_filename $expexted_pattern_filename \
422+ || return 1
423+ }
424+
385425# ###################################################################################################
386426
387427bmakelib.test.run_test_case happy_path_default_help
@@ -392,4 +432,6 @@ bmakelib.test.run_test_case when_tips_is_no
392432bmakelib.test.run_test_case when_convenience_target_is_no
393433bmakelib.test.run_test_case docblock_and_inline_mixed_styles
394434bmakelib.test.run_test_case when_show_bmakelib_is_yes
435+ bmakelib.test.run_test_case when_target_prerequisite_has_special_characters
436+
395437
0 commit comments