diff options
Diffstat (limited to 'tests/scripts/variables/define')
-rw-r--r-- | tests/scripts/variables/define | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/tests/scripts/variables/define b/tests/scripts/variables/define index f91519e..7324cbc 100644 --- a/tests/scripts/variables/define +++ b/tests/scripts/variables/define @@ -30,6 +30,10 @@ define simple := @echo $(FOO) endef +define posix ::= +@echo $(FOO) +endef + append = @echo a define append += @@ -49,10 +53,54 @@ FOO = there all: ; $(multi) $(simple) + $(posix) + $(append) + $(cond) +', + '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n"); + +# TEST 1a: Various new-style define/endef, with no spaces + +run_make_test(' +FOO = foo + +define multi= +echo hi +@echo $(FOO) +endef # this is the end + +define simple:= +@echo $(FOO) +endef + +define posix::= +@echo $(FOO) +endef + +append = @echo a + +define append+= + +@echo b +endef + +define cond?= # this is a conditional +@echo first +endef + +define cond?= +@echo second +endef + +FOO = there + +all: ; $(multi) + $(simple) + $(posix) $(append) $(cond) ', - '', "echo hi\nhi\nthere\nfoo\na\nb\nfirst\n"); + '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n"); # TEST 2: define in true section of conditional (containing conditional) @@ -112,7 +160,7 @@ ouch endef all: ; @echo ok ', - '', "#MAKEFILE#:3: extraneous text after `define' directive\nok\n"); + '', "#MAKEFILE#:3: extraneous text after 'define' directive\nok\n"); # TEST 7: NEGATIVE: extra text after endef @@ -123,7 +171,7 @@ ouch endef $(NAME) all: ; @echo ok ', - '', "#MAKEFILE#:5: extraneous text after `endef' directive\nok\n"); + '', "#MAKEFILE#:5: extraneous text after 'endef' directive\nok\n"); # TEST 8: NEGATIVE: missing endef @@ -134,7 +182,7 @@ define NAME = ouch endef$(NAME) ', - '', "#MAKEFILE#:4: *** missing `endef', unterminated `define'. Stop.\n", 512); + '', "#MAKEFILE#:4: *** missing 'endef', unterminated 'define'. Stop.\n", 512); # ------------------------- # Make sure that prefix characters apply properly to define/endef values. |