xref: /freebsd/contrib/bmake/unit-tests/cond-func-exists.mk (revision 7695ced633498a94c26466934321782acfc69307)
1# $NetBSD: cond-func-exists.mk,v 1.5 2020/10/24 08:46:08 rillig Exp $
2#
3# Tests for the exists() function in .if conditions.
4
5.if !exists(.)
6.  error
7.endif
8
9# The argument to the function must not be enclosed in quotes.
10# Neither double quotes nor single quotes are allowed.
11.if exists(".")
12.  error
13.endif
14
15.if exists('.')
16.  error
17.endif
18
19# The only way to escape characters that would otherwise influence the parser
20# is to enclose them in a variable expression.  For function arguments,
21# neither the backslash nor the dollar sign act as escape character.
22.if exists(\.)
23.  error
24.endif
25
26.if !exists(${:U.})
27.  error
28.endif
29
30# The argument to the function can have several variable expressions.
31# See cond-func.mk for the characters that cannot be used directly.
32.if !exists(${.PARSEDIR}/${.PARSEFILE})
33.  error
34.endif
35
36# Whitespace is trimmed on both sides of the function argument.
37.if !exists(	.	)
38.  error
39.endif
40
41all:
42	@:;
43