1*d5e0a182SSimon J. Gerraty# $NetBSD: directive-else.mk,v 1.9 2023/11/19 21:47:52 rillig Exp $ 22c3632d1SSimon J. Gerraty# 32c3632d1SSimon J. Gerraty# Tests for the .else directive. 406b9b3e0SSimon J. Gerraty# 506b9b3e0SSimon J. Gerraty# Since 2020-11-13, an '.else' followed by extraneous text generates a parse 606b9b3e0SSimon J. Gerraty# error in -dL (lint) mode. 706b9b3e0SSimon J. Gerraty# 806b9b3e0SSimon J. Gerraty# Since 2020-12-15, an '.else' followed by extraneous text always generates 906b9b3e0SSimon J. Gerraty# a parse error. 102c3632d1SSimon J. Gerraty 112c3632d1SSimon J. Gerraty.if 0 122c3632d1SSimon J. Gerraty. warning must not be reached 13148ee845SSimon J. Gerraty# expect+1: The .else directive does not take arguments 142c3632d1SSimon J. Gerraty.else 123 15148ee845SSimon J. Gerraty# expect+1: ok 162c3632d1SSimon J. Gerraty. info ok 172c3632d1SSimon J. Gerraty.endif 182c3632d1SSimon J. Gerraty 192c3632d1SSimon J. Gerraty.if 1 20148ee845SSimon J. Gerraty# expect+1: ok 212c3632d1SSimon J. Gerraty. info ok 22148ee845SSimon J. Gerraty# expect+1: The .else directive does not take arguments 232c3632d1SSimon J. Gerraty.else 123 242c3632d1SSimon J. Gerraty. warning must not be reached 252c3632d1SSimon J. Gerraty.endif 262c3632d1SSimon J. Gerraty 272c3632d1SSimon J. Gerraty# An .else without a corresponding .if is an error. 28148ee845SSimon J. Gerraty# expect+1: if-less else 292c3632d1SSimon J. Gerraty.else 302c3632d1SSimon J. Gerraty 312c3632d1SSimon J. Gerraty# Accidental extra .else directives are detected too. 322c3632d1SSimon J. Gerraty.if 0 332c3632d1SSimon J. Gerraty. warning must not be reached 342c3632d1SSimon J. Gerraty.else 35148ee845SSimon J. Gerraty# expect+1: ok 362c3632d1SSimon J. Gerraty. info ok 37148ee845SSimon J. Gerraty# expect+1: warning: extra else 382c3632d1SSimon J. Gerraty.else 392c3632d1SSimon J. Gerraty. info After an extra .else, everything is skipped. 402c3632d1SSimon J. Gerraty.endif 412c3632d1SSimon J. Gerraty 42e2eeea75SSimon J. Gerraty# An .else may have a comment. This comment does not count as an argument, 43e2eeea75SSimon J. Gerraty# therefore no parse error. 44e2eeea75SSimon J. Gerraty.if 0 45e2eeea75SSimon J. Gerraty.else # comment 46e2eeea75SSimon J. Gerraty.endif 47e2eeea75SSimon J. Gerraty 48*d5e0a182SSimon J. Gerraty# An expression does count as an argument, even if it is empty. 49e2eeea75SSimon J. Gerraty.if 0 50148ee845SSimon J. Gerraty# expect+1: The .else directive does not take arguments 51e2eeea75SSimon J. Gerraty.else ${:U} 52e2eeea75SSimon J. Gerraty.endif 53e2eeea75SSimon J. Gerraty 542c3632d1SSimon J. Gerratyall: 552c3632d1SSimon J. Gerraty @:; 56