build/pymake/tests/functions.mk

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/pymake/tests/functions.mk	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +all:
     1.5 +	test "$(subst e,EE,hello)" = "hEEllo"
     1.6 +	test "$(strip $(NULL)  test data  )" = "test data"
     1.7 +	test "$(findstring hell,hello)" = "hell"
     1.8 +	test "$(findstring heaven,hello)" = ""
     1.9 +	test "$(filter foo/%.c b%,foo/a.c b.c foo/a.o)" = "foo/a.c b.c"
    1.10 +	test "$(filter foo,foo bar)" = "foo"
    1.11 +	test "$(filter-out foo/%.c b%,foo/a.c b.c foo/a.o)" = "foo/a.o"
    1.12 +	test "$(filter-out %.c,foo,bar.c foo,bar.o)" = "foo,bar.o"
    1.13 +	test "$(sort .go a b aa A c cc)" = ".go A a aa b c cc"
    1.14 +	test "$(word 1, hello )" = "hello"
    1.15 +	test "$(word 2, hello )" = ""
    1.16 +	test "$(wordlist 1, 2, foo bar baz )" = "foo bar"
    1.17 +	test "$(words 1 2 3)" = "3"
    1.18 +	test "$(words )" = "0"
    1.19 +	test "$(firstword $(NULL) foo bar baz)" = "foo"
    1.20 +	test "$(firstword )" = ""
    1.21 +	test "$(dir foo.c path/foo.o dir/dir2/)" = "./ path/ dir/dir2/"
    1.22 +	test "$(notdir foo.c path/foo.o dir/dir2/)" = "foo.c foo.o "
    1.23 +	test "$(suffix src/foo.c dir/my.dir/foo foo.o)" = ".c .o"
    1.24 +	test "$(basename src/foo.c dir/my.dir/foo foo.c .c)" = "src/foo dir/my.dir/foo foo "
    1.25 +	test "$(addprefix src/,foo bar.c dir/foo)" = "src/foo src/bar.c src/dir/foo"
    1.26 +	test "$(addsuffix .c,foo dir/bar)" = "foo.c dir/bar.c"
    1.27 +	test "$(join a b c, 1 2 3)" = "a1 b2 c3"
    1.28 +	test "$(join a b, 1 2 3)" = "a1 b2 3"
    1.29 +	test "$(join a b c, 1 2)" = "a1 b2 c"
    1.30 +	test "$(if $(NULL) ,yes)" = ""
    1.31 +	test "$(if 1,yes,no)" = "yes"
    1.32 +	test "$(if ,yes,no )" = "no "
    1.33 +	test "$(if ,$(error Short-circuit problem))" = ""
    1.34 +	test "$(or $(NULL),1)" = "1"
    1.35 +	test "$(or $(NULL),2,$(warning TEST-FAIL bad or short-circuit))" = "2"
    1.36 +	test "$(and ,$(warning TEST-FAIL bad and short-circuit))" = ""
    1.37 +	test "$(and 1,2)" = "2"
    1.38 +	test "$(foreach i,foo bar,found:$(i))" = "found:foo found:bar"
    1.39 +	@echo TEST-PASS

mercurial