Module Name:    src
Committed By:   rillig
Date:           Sun Aug 23 15:09:15 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk
            varmod-extension.exp varmod-extension.mk varmod-head.exp
            varmod-head.mk varmod-root.exp varmod-root.mk varmod-tail.exp
            varmod-tail.mk

Log Message:
make(1): move tests for :H :E :R :T into separate files


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/make/unit-tests/modmisc.exp \
    src/usr.bin/make/unit-tests/modmisc.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-extension.exp \
    src/usr.bin/make/unit-tests/varmod-head.exp \
    src/usr.bin/make/unit-tests/varmod-root.exp \
    src/usr.bin/make/unit-tests/varmod-tail.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-extension.mk \
    src/usr.bin/make/unit-tests/varmod-head.mk \
    src/usr.bin/make/unit-tests/varmod-root.mk \
    src/usr.bin/make/unit-tests/varmod-tail.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.43 src/usr.bin/make/unit-tests/modmisc.exp:1.44
--- src/usr.bin/make/unit-tests/modmisc.exp:1.43	Sun Aug 16 12:48:55 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sun Aug 23 15:09:15 2020
@@ -8,10 +8,6 @@ path_/usr/xbin=/opt/xbin/
 paths=/bin /tmp / /no/such/dir /opt/xbin
 PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN
 The answer is 42
-dirname of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'a/b . . a.b . . . . .'
-basename of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'c def a.b.c c a a.a .gitignore a a.a'
-suffix of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'c b/c a gitignore a'
-root of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'a/b/c def a.b a a a a a'
 S:
 C:
 @:
Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.43 src/usr.bin/make/unit-tests/modmisc.mk:1.44
--- src/usr.bin/make/unit-tests/modmisc.mk:1.43	Sun Aug 16 12:48:55 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Aug 23 15:09:15 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.43 2020/08/16 12:48:55 rillig Exp $
+# $Id: modmisc.mk,v 1.44 2020/08/23 15:09:15 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -15,7 +15,7 @@ MOD_HOMES=S,/home/,/homes/,
 MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/usr,/opt,}}@
 MOD_SEP=S,:, ,g
 
-all:	modvar modvarloop modsysv mod-HTE emptyvar undefvar
+all:	modvar modvarloop modsysv emptyvar undefvar
 all:	mod-tu-space
 all:	mod-quote
 all:	mod-break-many-words
@@ -46,13 +46,6 @@ modvarloop:
 	@echo "paths=${paths}"
 	@echo "PATHS=${paths:tu}"
 
-PATHNAMES=	a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
-mod-HTE:
-	@echo "dirname of '"${PATHNAMES:Q}"' is '"${PATHNAMES:H:Q}"'"
-	@echo "basename of '"${PATHNAMES:Q}"' is '"${PATHNAMES:T:Q}"'"
-	@echo "suffix of '"${PATHNAMES:Q}"' is '"${PATHNAMES:E:Q}"'"
-	@echo "root of '"${PATHNAMES:Q}"' is '"${PATHNAMES:R:Q}"'"
-
 # When a modifier is applied to the "" variable, the result is discarded.
 emptyvar:
 	@echo S:${:S,^$,empty,}

Index: src/usr.bin/make/unit-tests/varmod-extension.exp
diff -u src/usr.bin/make/unit-tests/varmod-extension.exp:1.1 src/usr.bin/make/unit-tests/varmod-extension.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-extension.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-extension.exp	Sun Aug 23 15:09:15 2020
@@ -1 +1,10 @@
+extension of 'a/b/c' is ''
+extension of 'def' is ''
+extension of 'a.b.c' is 'c'
+extension of 'a.b/c' is 'b/c'
+extension of 'a' is ''
+extension of 'a.a' is 'a'
+extension of '.gitignore' is 'gitignore'
+extension of 'a' is ''
+extension of 'a.a' is 'a'
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-head.exp
diff -u src/usr.bin/make/unit-tests/varmod-head.exp:1.1 src/usr.bin/make/unit-tests/varmod-head.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-head.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-head.exp	Sun Aug 23 15:09:15 2020
@@ -1 +1,10 @@
+head (dirname) of 'a/b/c' is 'a/b'
+head (dirname) of 'def' is '.'
+head (dirname) of 'a.b.c' is '.'
+head (dirname) of 'a.b/c' is 'a.b'
+head (dirname) of 'a' is '.'
+head (dirname) of 'a.a' is '.'
+head (dirname) of '.gitignore' is '.'
+head (dirname) of 'a' is '.'
+head (dirname) of 'a.a' is '.'
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-root.exp
diff -u src/usr.bin/make/unit-tests/varmod-root.exp:1.1 src/usr.bin/make/unit-tests/varmod-root.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-root.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-root.exp	Sun Aug 23 15:09:15 2020
@@ -1 +1,10 @@
+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'
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-tail.exp
diff -u src/usr.bin/make/unit-tests/varmod-tail.exp:1.1 src/usr.bin/make/unit-tests/varmod-tail.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-tail.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-tail.exp	Sun Aug 23 15:09:15 2020
@@ -1 +1,10 @@
+tail (basename) of 'a/b/c' is 'c'
+tail (basename) of 'def' is 'def'
+tail (basename) of 'a.b.c' is 'a.b.c'
+tail (basename) of 'a.b/c' is 'c'
+tail (basename) of 'a' is 'a'
+tail (basename) of 'a.a' is 'a.a'
+tail (basename) of '.gitignore' is '.gitignore'
+tail (basename) of 'a' is 'a'
+tail (basename) of 'a.a' is 'a.a'
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-extension.mk
diff -u src/usr.bin/make/unit-tests/varmod-extension.mk:1.2 src/usr.bin/make/unit-tests/varmod-extension.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-extension.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-extension.mk	Sun Aug 23 15:09:15 2020
@@ -1,9 +1,9 @@
-# $NetBSD: varmod-extension.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-extension.mk,v 1.3 2020/08/23 15:09:15 rillig Exp $
 #
 # Tests for the :E variable modifier, which returns the filename extension
 # of each word in the variable.
 
-# TODO: Implementation
-
 all:
-	@:;
+.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
+	@echo "extension of '"${path:Q}"' is '"${path:E:Q}"'"
+.endfor
Index: src/usr.bin/make/unit-tests/varmod-head.mk
diff -u src/usr.bin/make/unit-tests/varmod-head.mk:1.2 src/usr.bin/make/unit-tests/varmod-head.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-head.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-head.mk	Sun Aug 23 15:09:15 2020
@@ -1,9 +1,9 @@
-# $NetBSD: varmod-head.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-head.mk,v 1.3 2020/08/23 15:09:15 rillig Exp $
 #
 # Tests for the :H variable modifier, which returns the dirname of
 # each of the words in the variable value.
 
-# TODO: Implementation
-
 all:
-	@:;
+.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
+	@echo "head (dirname) of '"${path:Q}"' is '"${path:H:Q}"'"
+.endfor
Index: src/usr.bin/make/unit-tests/varmod-root.mk
diff -u src/usr.bin/make/unit-tests/varmod-root.mk:1.2 src/usr.bin/make/unit-tests/varmod-root.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-root.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-root.mk	Sun Aug 23 15:09:15 2020
@@ -1,9 +1,9 @@
-# $NetBSD: varmod-root.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-root.mk,v 1.3 2020/08/23 15:09:15 rillig Exp $
 #
 # Tests for the :R variable modifier, which returns the filename root
 # without the extension.
 
-# TODO: Implementation
-
 all:
-	@:;
+.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
+	@echo "root of '"${path:Q}"' is '"${path:R:Q}"'"
+.endfor
Index: src/usr.bin/make/unit-tests/varmod-tail.mk
diff -u src/usr.bin/make/unit-tests/varmod-tail.mk:1.2 src/usr.bin/make/unit-tests/varmod-tail.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-tail.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-tail.mk	Sun Aug 23 15:09:15 2020
@@ -1,9 +1,9 @@
-# $NetBSD: varmod-tail.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-tail.mk,v 1.3 2020/08/23 15:09:15 rillig Exp $
 #
 # Tests for the :T variable modifier, which returns the basename of each of
 # the words in the variable value.
 
-# TODO: Implementation
-
 all:
-	@:;
+.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
+	@echo "tail (basename) of '"${path:Q}"' is '"${path:T:Q}"'"
+.endfor

Reply via email to