Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests tests/make: split test cases for ':R...



details:   https://anonhg.NetBSD.org/src/rev/4025bd3abde2
branches:  trunk
changeset: 1026760:4025bd3abde2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Dec 05 22:31:58 2021 +0000

description:
tests/make: split test cases for ':R' into separate tests

This allows to comment or explain individual test cases.

Remove duplicates.

diffstat:

 usr.bin/make/unit-tests/varmod-root.exp |  10 --------
 usr.bin/make/unit-tests/varmod-root.mk  |  37 +++++++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 14 deletions(-)

diffs (61 lines):

diff -r 3f6adbb0c318 -r 4025bd3abde2 usr.bin/make/unit-tests/varmod-root.exp
--- a/usr.bin/make/unit-tests/varmod-root.exp   Sun Dec 05 19:43:30 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-root.exp   Sun Dec 05 22:31:58 2021 +0000
@@ -1,11 +1,1 @@
-root of 'a/b/c' is 'a/b/c'
-root of 'def' is 'def'
-root of 'a.b.c' is 'a.b'
-root of 'a.b/c' is 'a'
-root of 'a' is 'a'
-root of 'a.a' is 'a'
-root of '.gitignore' is ''
-root of 'a' is 'a'
-root of 'a.a' is 'a'
-root of 'trailing/' is 'trailing/'
 exit status 0
diff -r 3f6adbb0c318 -r 4025bd3abde2 usr.bin/make/unit-tests/varmod-root.mk
--- a/usr.bin/make/unit-tests/varmod-root.mk    Sun Dec 05 19:43:30 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-root.mk    Sun Dec 05 22:31:58 2021 +0000
@@ -1,9 +1,38 @@
-# $NetBSD: varmod-root.mk,v 1.4 2020/12/20 22:57:40 rillig Exp $
+# $NetBSD: varmod-root.mk,v 1.5 2021/12/05 22:31:58 rillig Exp $
 #
 # Tests for the :R variable modifier, which returns the filename root
 # without the extension.
 
+.if ${a/b/c:L:R} != "a/b/c"
+.  error
+.endif
+
+.if ${def:L:R} != "def"
+.  error
+.endif
+
+.if ${a.b.c:L:R} != "a.b"
+.  error
+.endif
+
+.if ${a.b/c:L:R} != "a"
+.  error
+.endif
+
+.if ${a:L:R} != "a"
+.  error
+.endif
+
+.if ${a.a:L:R} != "a"
+.  error
+.endif
+
+.if ${.gitignore:L:R} != ""
+.  error
+.endif
+
+.if ${trailing/:L:R} != "trailing/"
+.  error
+.endif
+
 all:
-.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a trailing/
-       @echo "root of '"${path:Q}"' is '"${path:R:Q}"'"
-.endfor



Home | Main Index | Thread Index | Old Index