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 make(1): move tests for :H :E :R :T ...
details: https://anonhg.NetBSD.org/src/rev/7c62ce2544dc
branches: trunk
changeset: 1013247:7c62ce2544dc
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Aug 23 15:09:15 2020 +0000
description:
make(1): move tests for :H :E :R :T into separate files
diffstat:
usr.bin/make/unit-tests/modmisc.exp | 4 ----
usr.bin/make/unit-tests/modmisc.mk | 11 ++---------
usr.bin/make/unit-tests/varmod-extension.exp | 9 +++++++++
usr.bin/make/unit-tests/varmod-extension.mk | 8 ++++----
usr.bin/make/unit-tests/varmod-head.exp | 9 +++++++++
usr.bin/make/unit-tests/varmod-head.mk | 8 ++++----
usr.bin/make/unit-tests/varmod-root.exp | 9 +++++++++
usr.bin/make/unit-tests/varmod-root.mk | 8 ++++----
usr.bin/make/unit-tests/varmod-tail.exp | 9 +++++++++
usr.bin/make/unit-tests/varmod-tail.mk | 8 ++++----
10 files changed, 54 insertions(+), 29 deletions(-)
diffs (170 lines):
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp Sun Aug 23 15:09:15 2020 +0000
@@ -8,10 +8,6 @@
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:
@:
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk Sun Aug 23 15:09:15 2020 +0000
@@ -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_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 @@
@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,}
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/varmod-extension.exp
--- a/usr.bin/make/unit-tests/varmod-extension.exp Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-extension.exp Sun Aug 23 15:09:15 2020 +0000
@@ -1,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
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/varmod-extension.mk
--- a/usr.bin/make/unit-tests/varmod-extension.mk Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-extension.mk Sun Aug 23 15:09:15 2020 +0000
@@ -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
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/varmod-head.exp
--- a/usr.bin/make/unit-tests/varmod-head.exp Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-head.exp Sun Aug 23 15:09:15 2020 +0000
@@ -1,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
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/varmod-head.mk
--- a/usr.bin/make/unit-tests/varmod-head.mk Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-head.mk Sun Aug 23 15:09:15 2020 +0000
@@ -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
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/varmod-root.exp
--- a/usr.bin/make/unit-tests/varmod-root.exp Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-root.exp Sun Aug 23 15:09:15 2020 +0000
@@ -1,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
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/varmod-root.mk
--- a/usr.bin/make/unit-tests/varmod-root.mk Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-root.mk Sun Aug 23 15:09:15 2020 +0000
@@ -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
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/varmod-tail.exp
--- a/usr.bin/make/unit-tests/varmod-tail.exp Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-tail.exp Sun Aug 23 15:09:15 2020 +0000
@@ -1,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
diff -r 70fa11bb8dbd -r 7c62ce2544dc usr.bin/make/unit-tests/varmod-tail.mk
--- a/usr.bin/make/unit-tests/varmod-tail.mk Sun Aug 23 14:52:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-tail.mk Sun Aug 23 15:09:15 2020 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index