make(1): move tests for the :O and :Or modifiers into separate filesdiff -r1.2 -r1.3 src/usr.bin/make/unit-tests/modorder.exp
(rillig)
--- src/usr.bin/make/unit-tests/Attic/modorder.exp 2020/06/09 01:48:17 1.2
+++ src/usr.bin/make/unit-tests/Attic/modorder.exp 2020/08/16 20:13:10 1.3
@@ -1,12 +1,9 @@ | @@ -1,12 +1,9 @@ | |||
1 | LIST = one two three four five six seven eight nine ten | |||
2 | LIST:O = eight five four nine one seven six ten three two | |||
3 | LIST:Or = two three ten six seven one nine four five eight | |||
4 | LIST:Ox = Ok | 1 | LIST:Ox = Ok | |
5 | LIST:O:Ox = Ok | 2 | LIST:O:Ox = Ok | |
6 | LISTX = Ok | 3 | LISTX = Ok | |
7 | LISTSX = Ok | 4 | LISTSX = Ok | |
8 | make: Bad modifier `:OX' for LIST | 5 | make: Bad modifier `:OX' for LIST | |
9 | BADMOD 1 = } | 6 | BADMOD 1 = } | |
10 | make: Bad modifier `:OxXX' for LIST | 7 | make: Bad modifier `:OxXX' for LIST | |
11 | BADMOD 2 = XX} | 8 | BADMOD 2 = XX} | |
12 | exit status 0 | 9 | exit status 0 |
--- src/usr.bin/make/unit-tests/varmod-order-reverse.mk 2020/08/16 14:25:16 1.2
+++ src/usr.bin/make/unit-tests/varmod-order-reverse.mk 2020/08/16 20:13:10 1.3
@@ -1,9 +1,13 @@ | @@ -1,9 +1,13 @@ | |||
1 | # $NetBSD: varmod-order-reverse.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ | 1 | # $NetBSD: varmod-order-reverse.mk,v 1.3 2020/08/16 20:13:10 rillig Exp $ | |
2 | # | 2 | # | |
3 | # Tests for the :Or variable modifier, which returns the words, sorted in | 3 | # Tests for the :Or variable modifier, which returns the words, sorted in | |
4 | # descending order. | 4 | # descending order. | |
5 | 5 | |||
6 | # TODO: Implementation | 6 | NUMBERS= one two three four five six seven eight nine ten | |
7 | ||||
8 | .if ${NUMBERS:Or} != "two three ten six seven one nine four five eight" | |||
9 | .error ${NUMBERS:Or} | |||
10 | .endif | |||
7 | 11 | |||
8 | all: | 12 | all: | |
9 | @:; | 13 | @:; |
--- src/usr.bin/make/unit-tests/varmod-order.mk 2020/08/16 14:25:16 1.2
+++ src/usr.bin/make/unit-tests/varmod-order.mk 2020/08/16 20:13:10 1.3
@@ -1,9 +1,13 @@ | @@ -1,9 +1,13 @@ | |||
1 | # $NetBSD: varmod-order.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ | 1 | # $NetBSD: varmod-order.mk,v 1.3 2020/08/16 20:13:10 rillig Exp $ | |
2 | # | 2 | # | |
3 | # Tests for the :Or variable modifier, which returns the words, sorted in | 3 | # Tests for the :O variable modifier, which returns the words, sorted in | |
4 | # ascending order. | 4 | # ascending order. | |
5 | 5 | |||
6 | # TODO: Implementation | 6 | NUMBERS= one two three four five six seven eight nine ten | |
7 | ||||
8 | .if ${NUMBERS:O} != "eight five four nine one seven six ten three two" | |||
9 | .error ${NUMBERS:O} | |||
10 | .endif | |||
7 | 11 | |||
8 | all: | 12 | all: | |
9 | @:; | 13 | @:; |
--- src/usr.bin/make/unit-tests/Attic/modorder.mk 2020/06/09 01:48:17 1.3
+++ src/usr.bin/make/unit-tests/Attic/modorder.mk 2020/08/16 20:13:10 1.4
@@ -1,24 +1,21 @@ | @@ -1,24 +1,21 @@ | |||
1 | # $NetBSD: modorder.mk,v 1.3 2020/06/09 01:48:17 sjg Exp $ | 1 | # $NetBSD: modorder.mk,v 1.4 2020/08/16 20:13:10 rillig Exp $ | |
2 | 2 | |||
3 | LIST= one two three four five six seven eight nine ten | 3 | LIST= one two three four five six seven eight nine ten | |
4 | LISTX= ${LIST:Ox} | 4 | LISTX= ${LIST:Ox} | |
5 | LISTSX:= ${LIST:Ox} | 5 | LISTSX:= ${LIST:Ox} | |
6 | TEST_RESULT= && echo Ok || echo Failed | 6 | TEST_RESULT= && echo Ok || echo Failed | |
7 | 7 | |||
8 | # unit-tests have to produce the same results on each run | 8 | # unit-tests have to produce the same results on each run | |
9 | # so we cannot actually include :Ox output. | 9 | # so we cannot actually include :Ox output. | |
10 | all: | 10 | all: | |
11 | @echo "LIST = ${LIST}" | |||
12 | @echo "LIST:O = ${LIST:O}" | |||
13 | @echo "LIST:Or = ${LIST:Or}" | |||
14 | # Note that 1 in every 10! trials two independently generated | 11 | # Note that 1 in every 10! trials two independently generated | |
15 | # randomized orderings will be the same. The test framework doesn't | 12 | # randomized orderings will be the same. The test framework doesn't | |
16 | # support checking probabilistic output, so we accept that each of the | 13 | # support checking probabilistic output, so we accept that each of the | |
17 | # 3 :Ox tests will incorrectly fail with probability 2.756E-7, which | 14 | # 3 :Ox tests will incorrectly fail with probability 2.756E-7, which | |
18 | # lets the whole test fail once in 1.209.600 runs, on average. | 15 | # lets the whole test fail once in 1.209.600 runs, on average. | |
19 | @echo "LIST:Ox = `test '${LIST:Ox}' != '${LIST:Ox}' ${TEST_RESULT}`" | 16 | @echo "LIST:Ox = `test '${LIST:Ox}' != '${LIST:Ox}' ${TEST_RESULT}`" | |
20 | @echo "LIST:O:Ox = `test '${LIST:O:Ox}' != '${LIST:O:Ox}' ${TEST_RESULT}`" | 17 | @echo "LIST:O:Ox = `test '${LIST:O:Ox}' != '${LIST:O:Ox}' ${TEST_RESULT}`" | |
21 | @echo "LISTX = `test '${LISTX}' != '${LISTX}' ${TEST_RESULT}`" | 18 | @echo "LISTX = `test '${LISTX}' != '${LISTX}' ${TEST_RESULT}`" | |
22 | @echo "LISTSX = `test '${LISTSX}' = '${LISTSX}' ${TEST_RESULT}`" | 19 | @echo "LISTSX = `test '${LISTSX}' = '${LISTSX}' ${TEST_RESULT}`" | |
23 | @echo "BADMOD 1 = ${LIST:OX}" | 20 | @echo "BADMOD 1 = ${LIST:OX}" | |
24 | @echo "BADMOD 2 = ${LIST:OxXX}" | 21 | @echo "BADMOD 2 = ${LIST:OxXX}" |