1# $NetBSD: varmod-unique.mk,v 1.6 2021/12/05 22:37:58 rillig Exp $
2#
3# Tests for the :u variable modifier, which discards adjacent duplicate
4# words.
5
6.if ${1 2 1:L:u} != "1 2 1"
7.  warning The modifier ':u' only merges _adjacent_ duplicate words.
8.endif
9
10.if ${1 2 2 3:L:u} != "1 2 3"
11.  warning The modifier ':u' must merge adjacent duplicate words.
12.endif
13
14.if ${:L:u} != ""
15.  warning The modifier ':u' must do nothing with an empty word list.
16.endif
17
18.if ${   :L:u} != ""
19.  warning The modifier ':u' must normalize the whitespace.
20.endif
21
22.if ${word:L:u} != "word"
23.  warning The modifier ':u' must do nothing with a single-element word list.
24.endif
25
26.if ${   word   :L:u} != "word"
27.  warning The modifier ':u' must normalize the whitespace.
28.endif
29
30.if ${1 1 1 1 1 1 1 1:L:u} != "1"
31.  warning The modifier ':u' must merge _all_ adjacent duplicate words.
32.endif
33
34.if ${   1    2    1 1  :L:u} != "1 2 1"
35.  warning The modifier ':u' must normalize whitespace between the words.
36.endif
37
38.if ${1 1 1 1 2:L:u} != "1 2"
39.  warning Duplicate words at the beginning must be merged.
40.endif
41
42.if ${1 2 2 2 2:L:u} != "1 2"
43.  warning Duplicate words at the end must be merged.
44.endif
45
46all:
47