|
1 # -*- makefile -*- |
|
2 # |
|
3 # This Source Code Form is subject to the terms of the Mozilla Public |
|
4 # License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
5 # You can obtain one at http://mozilla.org/MPL/2.0/. |
|
6 |
|
7 # Verify dependencies are available |
|
8 $(call requiredfunction,getargv subargv is_XinY errorifneq) |
|
9 |
|
10 ifdef VERBOSE |
|
11 $(warning loading test) |
|
12 endif |
|
13 |
|
14 zero := 0 |
|
15 one := 1 |
|
16 |
|
17 # Verify 'invalid' is not matched |
|
18 val := invalid |
|
19 $(call errorifneq,$(zero),$(words $(call is_XinY,foo,$(val)))) |
|
20 $(call errorifneq,$(zero),$(words $(call is_XinY,clean,$(val)))) |
|
21 $(call errorifneq,$(zero),$(words $(call is_XinY,clean%,$(val)))) |
|
22 |
|
23 # verify strcmp('clean') |
|
24 val := clean |
|
25 $(call errorifneq,$(zero),$(words $(call is_XinY,foo,$(val)))) |
|
26 $(call errorifneq,$(one),$(words $(call is_XinY,clean,$(val)))) |
|
27 $(call errorifneq,$(one),$(words $(call is_XinY,clean%,$(val)))) |
|
28 $(call errorifneq,$(one),$(words $(call is_XinY,%clean,$(val)))) |
|
29 |
|
30 # List match for 'clean' |
|
31 val := blah clean distclean FcleanG clean-level-1 |
|
32 wanted := clean distclean clean-level-1 |
|
33 $(call errorifneq,$(zero),$(words $(call is_XinY_debug,foo,$(val)))) |
|
34 $(call errorifneq,$(one),$(words $(call is_XinY,clean,$(val)))) |
|
35 $(call errorifneq,$(one),$(words $(call is_XinY,distclean,$(val)))) |
|
36 |
|
37 # pattern match 'clean' |
|
38 # match: clean, distclean, clean-level-1 |
|
39 # exclude: FcleanG |
|
40 TEST_MAKECMDGOALS := $(val) |
|
41 $(call errorifneq,3,$(words $(call isTargetStemClean))) |
|
42 |
|
43 TEST_MAKECMDGOALS := invalid |
|
44 $(call errorifneq,$(zero),$(words $(call isTargetStemClean))) |
|
45 |
|
46 |
|
47 ############################# |
|
48 ifdef VERBOSE |
|
49 $(call banner,Unit test: isTargetStem) |
|
50 endif |
|
51 |
|
52 # Verify list argument processing |
|
53 TEST_MAKECMDGOALS := echo |
|
54 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show))) |
|
55 |
|
56 TEST_MAKECMDGOALS := echo-123 |
|
57 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show))) |
|
58 |
|
59 TEST_MAKECMDGOALS := show |
|
60 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show))) |
|
61 |
|
62 TEST_MAKECMDGOALS := show-123 |
|
63 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show))) |
|
64 |
|
65 TEST_MAKECMDGOALS := show-123-echo |
|
66 $(call errorifneq,$(one),$(words $(call isTargetStem,echo,show))) |
|
67 |
|
68 TEST_MAKECMDGOALS := invalid |
|
69 $(call errorifneq,$(zero),$(words $(call isTargetStem,echo,show))) |
|
70 |