xref: /freebsd/contrib/bmake/unit-tests/varmod-unique.mk (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1# $NetBSD: varmod-unique.mk,v 1.4 2020/08/31 17:41:38 rillig Exp $
2#
3# Tests for the :u variable modifier, which discards adjacent duplicate
4# words.
5
6.if ${:U1 2 1:u} != "1 2 1"
7.  warning The :u modifier only merges _adjacent_ duplicate words.
8.endif
9
10.if ${:U1 2 2 3:u} != "1 2 3"
11.  warning The :u modifier must merge adjacent duplicate words.
12.endif
13
14.if ${:U:u} != ""
15.  warning The :u modifier must do nothing with an empty word list.
16.endif
17
18.if ${:U1:u} != "1"
19.  warning The :u modifier must do nothing with a single-element word list.
20.endif
21
22.if ${:U1 1 1 1 1 1 1 1:u} != "1"
23.  warning The :u modifier must merge _all_ adjacent duplicate words.
24.endif
25
26.if ${:U   1    2    1 1  :u} != "1 2 1"
27.  warning The :u modifier must normalize whitespace between the words.
28.endif
29
30.if ${:U1 1 1 1 2:u} != "1 2"
31.  warning Duplicate words at the beginning must be merged.
32.endif
33
34.if ${:U1 2 2 2 2:u} != "1 2"
35.  warning Duplicate words at the end must be merged.
36.endif
37
38all:
39	@:;
40