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: clean up comments in tests
details: https://anonhg.NetBSD.org/src/rev/d392df899a8a
branches: trunk
changeset: 374718:d392df899a8a
user: rillig <rillig%NetBSD.org@localhost>
date: Wed May 10 15:53:32 2023 +0000
description:
tests/make: clean up comments in tests
diffstat:
usr.bin/make/unit-tests/cond-func.mk | 12 ++++++------
usr.bin/make/unit-tests/cond-late.mk | 15 ++++++++++-----
usr.bin/make/unit-tests/dep-var.mk | 7 ++++---
usr.bin/make/unit-tests/varmod-gmtime.mk | 4 ++--
usr.bin/make/unit-tests/varmod-localtime.mk | 4 ++--
usr.bin/make/unit-tests/varmod-path.mk | 14 ++++++++------
6 files changed, 32 insertions(+), 24 deletions(-)
diffs (156 lines):
diff -r 0f9deeee0636 -r d392df899a8a usr.bin/make/unit-tests/cond-func.mk
--- a/usr.bin/make/unit-tests/cond-func.mk Wed May 10 15:52:50 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-func.mk Wed May 10 15:53:32 2023 +0000
@@ -1,12 +1,12 @@
-# $NetBSD: cond-func.mk,v 1.11 2022/01/07 19:30:17 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.12 2023/05/10 15:53:32 rillig Exp $
#
# Tests for those parts of the functions in .if conditions that are common
# among several functions.
#
-# The below test uses the function defined(...) since it has no side-effects,
-# the other functions (except empty(...)) would work equally well. The
-# function empty is special because it uses a different parsing algorithm for
-# its argument.
+# The below test uses the 'defined' function since it has no side-effects.
+# The other functions would work equally well, except for 'empty', which
+# parses its argument differently from the other functions.
+#
DEF= defined
${:UA B}= variable name with spaces
@@ -74,7 +74,7 @@ VARNAME_UNBALANCED_BRACES= VAR{{{value
# There may be spaces around the operators and parentheses, and even
# inside the parentheses. The spaces inside the parentheses are not
-# allowed for the empty() function (see cond-func-empty.mk), therefore
+# allowed for the 'empty' function (see cond-func-empty.mk), therefore
# they are typically omitted for the other functions as well.
.if ! defined ( DEF )
. error
diff -r 0f9deeee0636 -r d392df899a8a usr.bin/make/unit-tests/cond-late.mk
--- a/usr.bin/make/unit-tests/cond-late.mk Wed May 10 15:52:50 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-late.mk Wed May 10 15:53:32 2023 +0000
@@ -1,11 +1,12 @@
-# $NetBSD: cond-late.mk,v 1.3 2020/11/15 14:07:53 rillig Exp $
+# $NetBSD: cond-late.mk,v 1.4 2023/05/10 15:53:32 rillig Exp $
#
# Using the :? modifier, variable expressions can contain conditional
# expressions that are evaluated late, at expansion time.
#
-# Any variables appearing in these
-# conditions are expanded before parsing the condition. This is
-# different from many other places.
+# Any expressions appearing in these conditions are expanded before parsing
+# the condition. This is different from conditions in .if directives, where
+# expressions are evaluated individually and only as far as necessary, see
+# cond-short.mk.
#
# Because of this, variables that are used in these lazy conditions
# should not contain double-quotes, or the parser will probably fail.
@@ -22,10 +23,14 @@ COND.false= "yes" != "yes"
# If the order of evaluation were to change to first parse the condition
# and then expand the variables, the output would change from the
# current "yes no" to "yes yes", since both variables are non-empty.
+# expect: yes
+# expect: no
cond-literal:
@echo ${ ${COND.true} :?yes:no}
@echo ${ ${COND.false} :?yes:no}
-VAR+= ${${UNDEF} != "no":?:}
+VAR= ${${UNDEF} != "no":?:}
+# expect-reset
+# expect: make: Bad conditional expression ' != "no"' in ' != "no"?:'
.if empty(VAR:Mpattern)
.endif
diff -r 0f9deeee0636 -r d392df899a8a usr.bin/make/unit-tests/dep-var.mk
--- a/usr.bin/make/unit-tests/dep-var.mk Wed May 10 15:52:50 2023 +0000
+++ b/usr.bin/make/unit-tests/dep-var.mk Wed May 10 15:53:32 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: dep-var.mk,v 1.7 2023/02/13 21:01:46 rillig Exp $
+# $NetBSD: dep-var.mk,v 1.8 2023/05/10 15:53:32 rillig Exp $
#
# Tests for variable references in dependency declarations.
#
@@ -91,5 +91,6 @@ undef1 def2 a-def2-b 1-2-$$INDIRECT_2-2-
.MAKEFLAGS: -d0
-# XXX: Why is the exit status still 0, even though Parse_Error is called
-# with PARSE_FATAL in SuffExpandChildren?
+# XXX: The exit status is still 0, even though Parse_Error is called with
+# PARSE_FATAL in SuffExpandChildren. The exit status is only affected by
+# parse errors when they occur in the parsing phase, see Parse_File.
diff -r 0f9deeee0636 -r d392df899a8a usr.bin/make/unit-tests/varmod-gmtime.mk
--- a/usr.bin/make/unit-tests/varmod-gmtime.mk Wed May 10 15:52:50 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-gmtime.mk Wed May 10 15:53:32 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-gmtime.mk,v 1.13 2023/05/09 16:31:41 rillig Exp $
+# $NetBSD: varmod-gmtime.mk,v 1.14 2023/05/10 15:53:32 rillig Exp $
#
# Tests for the :gmtime variable modifier, which formats a timestamp
# using strftime(3) in UTC.
@@ -129,7 +129,7 @@
.endif
# Before var.c 1.1050 from 2023-05-09, the timestamp could be directly
-# followed by the next modifier, without a ':' separator. This is the same
+# followed by the next modifier, without a ':' separator. This was the same
# bug as for the ':L' and ':P' modifiers.
.if ${%Y:L:gmtime=100000S,1970,bad,} != "bad"
. error
diff -r 0f9deeee0636 -r d392df899a8a usr.bin/make/unit-tests/varmod-localtime.mk
--- a/usr.bin/make/unit-tests/varmod-localtime.mk Wed May 10 15:52:50 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-localtime.mk Wed May 10 15:53:32 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-localtime.mk,v 1.11 2023/05/09 16:31:41 rillig Exp $
+# $NetBSD: varmod-localtime.mk,v 1.12 2023/05/10 15:53:32 rillig Exp $
#
# Tests for the :localtime variable modifier, which formats a timestamp
# using strftime(3) in local time.
@@ -129,7 +129,7 @@
.endif
# Before var.c 1.1050 from 2023-05-09, the timestamp could be directly
-# followed by the next modifier, without a ':' separator. This is the same
+# followed by the next modifier, without a ':' separator. This was the same
# bug as for the ':L' and ':P' modifiers.
.if ${%Y:L:localtime=100000S,1970,bad,} != "bad"
. error
diff -r 0f9deeee0636 -r d392df899a8a usr.bin/make/unit-tests/varmod-path.mk
--- a/usr.bin/make/unit-tests/varmod-path.mk Wed May 10 15:52:50 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-path.mk Wed May 10 15:53:32 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-path.mk,v 1.3 2020/08/23 08:10:49 rillig Exp $
+# $NetBSD: varmod-path.mk,v 1.4 2023/05/10 15:53:32 rillig Exp $
#
# Tests for the :P variable modifier, which looks up the path for a given
# target.
@@ -7,11 +7,12 @@
# as of 2020-08-23 it is nevertheless resolved to a path. This is probably
# unintended.
#
-# The real target is located in a subdirectory, and its full path is returned.
-# If it had been in the current directory, the difference between its path and
-# its name would not be visible.
+# In this test, the real target is located in a subdirectory, and its full
+# path is returned. If it had been in the current directory, the difference
+# between its path and its name would not be visible.
#
-# The enoent target does not exist, therefore the target name is returned.
+# The enoent target does not exist, therefore the plain name of the target
+# is returned.
.MAIN: all
@@ -20,7 +21,8 @@
_!= > varmod-path.subdir/varmod-path.phony
_!= > varmod-path.subdir/varmod-path.real
-# To have an effect, this .PATH declaration must be after the directory is created.
+# To have an effect, this .PATH declaration must be processed after the
+# directory has been created.
.PATH: varmod-path.subdir
varmod-path.phony: .PHONY
Home |
Main Index |
Thread Index |
Old Index