xref: /freebsd/contrib/bmake/unit-tests/varmod-order-string.mk (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1# $NetBSD: varmod-order-string.mk,v 1.2 2021/08/03 04:46:49 rillig Exp $
2#
3# Tests for the :O variable modifier, which returns the words, sorted in
4# ascending order.
5
6# Simple words are sorted lexicographically.
7WORDS=		one two three four five six seven eight nine ten
8.if ${WORDS:O} != "eight five four nine one seven six ten three two"
9.  error ${WORDS:O}
10.endif
11
12# Double quotes and single quotes delimit words, while backticks are just
13# regular characters.  Therefore '`in' is a separate word from 'backticks`',
14# and the additional spaces between them are removed.
15QUOTED_WORDS=	none "double   quoted" 'single   quoted' `in   backticks`
16.if ${QUOTED_WORDS:O} != "\"double   quoted\" 'single   quoted' `in backticks` none"
17.  error ${QUOTED_WORDS:O}
18.endif
19
20# Numbers are sorted lexicographically as well.
21# To sort the words numerically, use ':On' instead; since var.c 1.939 from
22# 2021-07-30.
23NUMBERS=	-100g -50m -7k -50 -13 0 000 13 50 5k1 7k 50m 100G
24.if ${NUMBERS:O} != "-100g -13 -50 -50m -7k 0 000 100G 13 50 50m 5k1 7k"
25.  error ${NUMBERS:O}
26.endif
27
28all:
29