Update ooo320-m1
[ooovba.git] / dmake / tests / function_macros-1
blob6e5368005a638180d76b6f4a3e19d90f7475a7eb
1 #!/bin/sh
3 # 01.06.2005 Volker Quetschke
4 # Tests for dmake function macros. (issue 36027, issue 37053)
6 : ${DMAKEPROG:=dmake}
7 file1="mymakefile.mk"
8 tmpfiles="$file1"
10 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
12 trap 'rm -rf $tmpfiles' 1 2 3 15
14 # Remember to quote variables in generated makefiles( $ -> \$ ).
15 cat > $file1 <<EOT
16 # Testing function macros
17 SHELL*:=/bin/sh
18 SHELLFLAGS*:=-ce
20 TEST1:=a b c
22 all:
23 @echo \$\$(and ...) section
24 test "::" = ":\$(and \$(nil) \$(nil) ):"
25 test ":t:" = ":\$(and a b ):"
26 test "::" = ":\$(and \$(nil) \
27 \$(nil) ):"
28 test "::" = ":\$(and \
29 ):"
31 @echo -e \n\$\$(assign ...) section
32 test ":A:" = ":\$(assign A := B ):"
33 test "\$(A)" = "B"
34 test ":A:" = ":\$(assign A\
35 := C ):"
36 test "\$(A)" = "C"
38 @echo -e \n\$\$(echo ...) section
39 test ":123:" = ":\$(echo 123 ):"
40 test ":123:" = ":\$(echo 123 ):"
41 test ":123:" = ":\$(echo\
42 123 ):"
43 test ":123:" = ":\$(echo \
44 123 ):"
46 @echo -e \n\$\$(eq ...) section
47 test ":true:" = ":\$(eq,1,1 true false):"
48 test ":true:" = ":\$(eq,1,1\
49 true false):"
51 # These tests need to use a shell
52 +@echo -e '\n\$\$(foreach ...) section'
53 +test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i]):"
54 +test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i]):"
55 +test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) [\$i] ):"
56 +test ":[a] [b] [c]:" = ":\$(foreach,i,\$(TEST1) \
57 [\$i] ):"
59 @echo -e \n\$\$(nil ...) section
60 test "::" = ":\$(nil abc):"
61 # Fails with syntax error
62 test "::" = ":\$(nil \
63 ):"
65 @echo -e \n\$\$(not ...) section
66 test "::" = ":\$(not abc):"
67 test ":t:" = ":\$(not \$(NULL)):"
68 test ":t:" = ":\$(not ):"
69 test ":t:" = ":\$(not \
70 ):"
72 @echo -e \n\$\$(null ...) section
73 test ":true:" = ":\$(null, true false):"
74 test ":false:" = ":\$(null,a true false):"
75 test ":false:" = ":\$(null,a true false ):"
76 test ":false:" = ":\$(null,a \
77 true false ):"
78 test ":true:" = ":\$(null, \
79 true false ):"
81 @echo -e \n\$\$(or ...) section
82 test "::" = ":\$(or \$(nil) \$(nil) ):"
83 test ":t:" = ":\$(or a \$(nil) ):"
84 test "::" = ":\$(or \$(nil) \
85 \$(nil) ):"
86 test "::" = ":\$(or \
87 ):"
89 EOT
91 ${DMAKEPROG} -r -f $file1
92 result=$?
94 test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles}
95 test $result -ne 0 && echo "Failure!"
96 exit $result