diff options
Diffstat (limited to 'unit-tests/directive-include.mk')
-rwxr-xr-x | unit-tests/directive-include.mk | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/unit-tests/directive-include.mk b/unit-tests/directive-include.mk index d36914b25a63..a6b300b3d273 100755 --- a/unit-tests/directive-include.mk +++ b/unit-tests/directive-include.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-include.mk,v 1.5 2020/11/21 14:59:11 rillig Exp $ +# $NetBSD: directive-include.mk,v 1.7 2021/12/03 22:48:07 rillig Exp $ # # Tests for the .include directive, which includes another file. @@ -30,5 +30,25 @@ # As of 2020-11-21, anything after the delimiter '"' is ignored. .include "/dev/null" and ignore anything in the rest of the line. +# The filename to be included can contain expressions. +DEV= null +.include "/dev/${DEV}" + +# Expressions in double quotes or angle quotes are first parsed naively, to +# find the closing '"'. In a second step, the expressions are expanded. This +# means that the expressions cannot include the characters '"' or '>'. This +# restriction is not practically relevant since the expressions inside +# '.include' directives are typically kept as simple as possible. +# +# If the whole line were expanded before parsing, the filename to be included +# would be empty, and the closing '"' would be in the trailing part of the +# line, which is ignored as of 2021-12-03. +DQUOT= " +.include "${DQUOT}" + +# When the expression in a filename cannot be evaluated, the failing +# expression is skipped and the file is included nevertheless. +# FIXME: Add proper error handling, no file must be included here. +.include "nonexistent${:U123:Z}.mk" + all: - @:; |