make(1): add tests for variable modifiers on trailing slashes

This commit is contained in:
rillig 2020-12-20 22:57:40 +00:00
parent 94f06ed7ea
commit 26a72fc416
8 changed files with 12 additions and 8 deletions

View File

@ -7,4 +7,5 @@ extension of 'a.a' is 'a'
extension of '.gitignore' is 'gitignore'
extension of 'a' is ''
extension of 'a.a' is 'a'
extension of 'trailing/' is ''
exit status 0

View File

@ -1,9 +1,9 @@
# $NetBSD: varmod-extension.mk,v 1.3 2020/08/23 15:09:15 rillig Exp $
# $NetBSD: varmod-extension.mk,v 1.4 2020/12/20 22:57:40 rillig Exp $
#
# Tests for the :E variable modifier, which returns the filename extension
# of each word in the variable.
all:
.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a trailing/
@echo "extension of '"${path:Q}"' is '"${path:E:Q}"'"
.endfor

View File

@ -7,4 +7,5 @@ head (dirname) of 'a.a' is '.'
head (dirname) of '.gitignore' is '.'
head (dirname) of 'a' is '.'
head (dirname) of 'a.a' is '.'
head (dirname) of 'trailing/' is 'trailing'
exit status 0

View File

@ -1,9 +1,9 @@
# $NetBSD: varmod-head.mk,v 1.3 2020/08/23 15:09:15 rillig Exp $
# $NetBSD: varmod-head.mk,v 1.4 2020/12/20 22:57:40 rillig Exp $
#
# Tests for the :H variable modifier, which returns the dirname of
# each of the words in the variable value.
all:
.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a trailing/
@echo "head (dirname) of '"${path:Q}"' is '"${path:H:Q}"'"
.endfor

View File

@ -7,4 +7,5 @@ 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

View File

@ -1,9 +1,9 @@
# $NetBSD: varmod-root.mk,v 1.3 2020/08/23 15:09:15 rillig Exp $
# $NetBSD: varmod-root.mk,v 1.4 2020/12/20 22:57:40 rillig Exp $
#
# Tests for the :R variable modifier, which returns the filename root
# without the extension.
all:
.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
.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

View File

@ -7,4 +7,5 @@ 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'
tail (basename) of 'trailing/' is ''
exit status 0

View File

@ -1,9 +1,9 @@
# $NetBSD: varmod-tail.mk,v 1.3 2020/08/23 15:09:15 rillig Exp $
# $NetBSD: varmod-tail.mk,v 1.4 2020/12/20 22:57:40 rillig Exp $
#
# Tests for the :T variable modifier, which returns the basename of each of
# the words in the variable value.
all:
.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
.for path in a/b/c def a.b.c a.b/c a a.a .gitignore a a.a trailing/
@echo "tail (basename) of '"${path:Q}"' is '"${path:T:Q}"'"
.endfor