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