make/tests/scripts/functions/sort
Paul Smith e97159745d [SV 46995] Strip leading/trailing space from variable names
* makeint.h: Change MAP_SPACE to MAP_NEWLINE, and add MAP_PATHSEP
and MAP_SPACE which is now MAP_BLANK|MAP_NEWLINE.  Create
NEW_TOKEN(), END_OF_TOKEN(), ISBLANK(), ISSPACE() macros.
* main.c (initialize_stopchar_map): Set MAP_NEWLINE only for
newline characters.
* Convert all uses of isblank() and isspace() to macros.
* Examine all uses of isblank() (doesn't accept newlines) and
change them wherever possible to ISSPACE() (does accept newlines).
* function.c (func_foreach): Strip leading/trailing space.
* variable.c (parse_variable_definition): Clean up.
* tests/scripts/functions/foreach: Test settings and errors.
* tests/scripts/functions/call: Rewrite to new-style.
* tests/scripts/misc/bs-nl: Add many more tests for newlines.
2016-03-23 01:25:51 -04:00

51 lines
1.7 KiB
Perl

# -*-perl-*-
$description = "The following test creates a makefile to verify
the ability of make to sort lists of object. Sort
will also remove any duplicate entries. This will also
be tested.";
$details = "The make file is built with a list of object in a random order
and includes some duplicates. Make should sort all of the elements
remove all duplicates\n";
run_make_test('
foo := moon_light days
foo1:= jazz
bar := captured
bar2 = boy end, has rise A midnight
bar3:= $(foo)
s1 := _by
s2 := _and_a
t1 := $(addsuffix $(s1), $(bar) )
t2 := $(addsuffix $(s2), $(foo1) )
t3 := $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2) $(t2)
t4 := $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3) $(t3)
t5 := $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4) $(t4)
t6 := $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5) $(t5)
t7 := $(t6) $(t6) $(t6)
p1 := $(addprefix $(foo1), $(s2) )
blank:=
all:
@echo $(sort $(bar2) $(foo) $(addsuffix $(s1), $(bar) ) $(t2) $(bar2) $(bar3))
@echo $(sort $(blank) $(foo) $(bar2) $(t1) $(p1) )
@echo $(sort $(foo) $(bar2) $(t1) $(t4) $(t5) $(t7) $(t6) )
',
'', 'A boy captured_by days end, has jazz_and_a midnight moon_light rise
A boy captured_by days end, has jazz_and_a midnight moon_light rise
A boy captured_by days end, has jazz_and_a midnight moon_light rise
');
# Test with non-space/tab whitespace. Note that you can't see the
# original bug except using valgrind.
run_make_test("FOO = a b\tc\rd\fe \f \f \f \f \ff
all: ; \@echo \$(words \$(sort \$(FOO)))\n",
'', "6\n");
1;
### Local Variables:
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
### End: