make/tests/scripts/variables/flavors
Paul Smith ef6461611b Add support for "::=" simple assignment operator.
The next POSIX standard will define "::=" to have the same behavior
as GNU make's ":=", so add support for this new operator.
2012-01-30 00:21:57 +00:00

96 lines
1.4 KiB
Perl

# -*-perl-*-
$description = "Test various flavors of make variable setting.";
$details = "";
# TEST 0: Recursive
run_make_test('
ugh = Goodbye
foo = $(bar)
bar = ${ugh}
ugh = Hello
all: ; @echo $(foo)
',
'', "Hello\n");
# TEST 1: Simple
run_make_test('
bar = Goodbye
foo := $(bar)
bar = ${ugh}
ugh = Hello
all: ; @echo $(foo)
',
'', "Goodbye\n");
# TEST 2: Append to recursive
run_make_test('
foo = Hello
ugh = Goodbye
foo += $(bar)
bar = ${ugh}
ugh = Hello
all: ; @echo $(foo)
',
'', "Hello Hello\n");
# TEST 3: Append to simple
run_make_test('
foo := Hello
ugh = Goodbye
bar = ${ugh}
foo += $(bar)
ugh = Hello
all: ; @echo $(foo)
',
'', "Hello Goodbye\n");
# TEST 4: Conditional pre-set
run_make_test('
foo = Hello
ugh = Goodbye
bar = ${ugh}
foo ?= $(bar)
ugh = Hello
all: ; @echo $(foo)
',
'', "Hello\n");
# TEST 5: Conditional unset
run_make_test('
ugh = Goodbye
bar = ${ugh}
foo ?= $(bar)
ugh = Hello
all: ; @echo $(foo)
',
'', "Hello\n");
# TEST 6: Simple using POSIX syntax
run_make_test('
bar = Goodbye
foo ::= $(bar)
bar = ${ugh}
ugh = Hello
all: ; @echo $(foo)
',
'', "Goodbye\n");
# TEST 7: POSIX syntax no spaces
run_make_test('
bar = Goodbye
foo::=$(bar)
bar = ${ugh}
ugh = Hello
all: ; @echo $(foo)
',
'', "Goodbye\n");
1;