Home | History | Annotate | Line # | Download | only in unit-tests
varparse-errors.mk revision 1.2
      1 # $NetBSD: varparse-errors.mk,v 1.2 2020/12/01 20:15:23 rillig Exp $
      2 
      3 # Tests for parsing and evaluating all kinds of variable expressions.
      4 #
      5 # This is the basis for redesigning the error handling in Var_Parse and
      6 # Var_Subst, collecting typical and not so typical use cases.
      7 #
      8 # See also:
      9 #	VarParseResult
     10 #	Var_Parse
     11 #	Var_Subst
     12 
     13 PLAIN=		plain value
     14 
     15 LITERAL_DOLLAR=	To get a dollar, double $$ it.
     16 
     17 INDIRECT=	An ${:Uindirect} value.
     18 
     19 REF_UNDEF=	A reference to an ${UNDEF}undefined variable.
     20 
     21 ERR_UNCLOSED=	An ${UNCLOSED variable expression.
     22 
     23 ERR_BAD_MOD=	An ${:Uindirect:Z} expression with an unknown modifier.
     24 
     25 ERR_EVAL=	An evaluation error ${:Uvalue:C,.,\3,}.
     26 
     27 # In a conditional, a variable expression that is not enclosed in quotes is
     28 # expanded using the flags VARE_UNDEFERR and VARE_WANTRES.
     29 # The variable itself must be defined.
     30 # It may refer to undefined variables though.
     31 .if ${REF_UNDEF} != "A reference to an undefined variable."
     32 .  error
     33 .endif
     34 
     35 # As of 2020-12-01, errors in the variable name are silently ignored.
     36 VAR.${:U:Z}=	unknown modifier in the variable name
     37 .if ${VAR.} != "unknown modifier in the variable name"
     38 .  error
     39 .endif
     40 
     41 # As of 2020-12-01, errors in the variable name are silently ignored.
     42 VAR.${:U:Z}post=	unknown modifier with text in the variable name
     43 .if ${VAR.post} != "unknown modifier with text in the variable name"
     44 .  error
     45 .endif
     46 
     47 all:
     48