make/tests/scripts/variables/flavors
Paul Smith e334942e57 Numerous updates and bug fixes.
A number of W32 cleanups from J.Grant.
A number of OS/2 cleanups from Andreas Buening.
Various random bug fixes.
2004-03-22 15:11:48 +00:00

86 lines
1.3 KiB
Perl

# -*-perl-*-
$description = "Test various flavors of make variable setting.";
$details = "";
open(MAKEFILE, "> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<'EOF';
foo = $(bar)
bar = ${ugh}
ugh = Hello
all: multi ; @echo $(foo)
multi: ; $(multi)
x := foo
y := $(x) bar
x := later
nullstring :=
space := $(nullstring) $(nullstring)
next: ; @echo $x$(space)$y
define multi
@echo hi
echo there
endef
ifdef BOGUS
define
@echo error
endef
endif
define outer
define inner
A = B
endef
endef
$(eval $(outer))
outer: ; @echo $(inner)
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
# TEST #1
# -------
&run_make_with_options($makefile, "", &get_logfile);
$answer = "hi\necho there\nthere\nHello\n";
&compare_output($answer, &get_logfile(1));
# TEST #2
# -------
&run_make_with_options($makefile, "next", &get_logfile);
$answer = "later foo bar\n";
&compare_output($answer, &get_logfile(1));
# TEST #3
# -------
&run_make_with_options($makefile, "BOGUS=true", &get_logfile, 512);
$answer = "$makefile:24: *** empty variable name. Stop.\n";
&compare_output($answer, &get_logfile(1));
# TEST #4
# -------
&run_make_with_options($makefile, "outer", &get_logfile);
$answer = "A = B\n";
&compare_output($answer, &get_logfile(1));
1;