diff options
Diffstat (limited to 'src/kmk/tests/scripts/features/override')
-rw-r--r-- | src/kmk/tests/scripts/features/override | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/src/kmk/tests/scripts/features/override b/src/kmk/tests/scripts/features/override index 23e4f2b..fff6c4e 100644 --- a/src/kmk/tests/scripts/features/override +++ b/src/kmk/tests/scripts/features/override @@ -1,34 +1,45 @@ -$description = "The following test creates a makefile to ..."; +# -*-perl-*- -$details = ""; - -open(MAKEFILE,"> $makefile"); - -# The Contents of the MAKEFILE ... - -print MAKEFILE "override define foo\n" - ."\@echo First comes the definition.\n" - ."\@echo Then comes the override.\n" - ."endef\n" - ."all: \n" - ."\t\$(foo)\n"; +$description = "Test the override directive on variable assignments."; -# END of Contents of MAKEFILE - -close(MAKEFILE); +$details = ""; -&run_make_with_options($makefile,"foo=Hello",&get_logfile); +# TEST 0: Basic override -# Create the answer to what should be produced by this Makefile -$answer = "First comes the definition.\n" - ."Then comes the override.\n"; +run_make_test(' +X = start +override recur = $(X) +override simple := $(X) +X = end +all: ; @echo "$(recur) $(simple)" +', + 'recur=I simple=J', "end start\n"); -&compare_output($answer,&get_logfile(1)); +# TEST 1: Override with append -1; +run_make_test(' +X += X1 +override X += X2 +override Y += Y1 +Y += Y2 +all: ; @echo "$(X) $(Y)" +', + '', "X1 X2 Y1\n"); +# TEST 2: Override with append to the command line +run_make_test(undef, 'X=C Y=C', "C X2 C Y1\n"); +# Test override of define/endef +run_make_test(' +override define foo +@echo First comes the definition. +@echo Then comes the override. +endef +all: ; $(foo) +', + 'foo=Hello', "First comes the definition.\nThen comes the override.\n"); +1; |