aboutsummaryrefslogtreecommitdiffstats
path: root/unit-tests/forloop
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2012-06-25 22:20:51 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2012-06-25 22:20:51 +0000
commit0fae4a3feb6507525100ba80841fb42e993656b0 (patch)
tree5bd1563c152e800aa8f10e98ac0713d41c302eb5 /unit-tests/forloop
parentb379932fc0f836f9f3f5ac89ef7f6cd38377dff8 (diff)
downloadsrc-0fae4a3feb6507525100ba80841fb42e993656b0.tar.gz
src-0fae4a3feb6507525100ba80841fb42e993656b0.zip
Import the 20-June-2012 release of the "Portable" BSD make tool (from NetBSD).vendor/NetBSD/bmake/20120620
Submitted by: sjg@juniper.net
Notes
Notes: svn path=/vendor/NetBSD/bmake/dist/; revision=237578 svn path=/vendor/NetBSD/bmake/20120620/; revision=237580; tag=vendor/NetBSD/bmake/20120620
Diffstat (limited to 'unit-tests/forloop')
-rw-r--r--unit-tests/forloop45
1 files changed, 45 insertions, 0 deletions
diff --git a/unit-tests/forloop b/unit-tests/forloop
new file mode 100644
index 000000000000..0b50e6675f6c
--- /dev/null
+++ b/unit-tests/forloop
@@ -0,0 +1,45 @@
+# $Id: forloop,v 1.1.1.1 2012/06/19 23:30:49 sjg Exp $
+
+all: for-loop
+
+LIST = one "two and three" four "five"
+
+.if make(for-fail)
+for-fail:
+
+XTRA_LIST = xtra
+.else
+
+.for x in ${LIST}
+X!= echo 'x=$x' >&2; echo
+.endfor
+
+CFL = -I/this -I"This or that" -Ithat "-DTHIS=\"this and that\""
+cfl=
+.for x in ${CFL}
+X!= echo 'x=$x' >&2; echo
+.if empty(cfl)
+cfl= $x
+.else
+cfl+= $x
+.endif
+.endfor
+X!= echo 'cfl=${cfl}' >&2; echo
+
+.if ${cfl} != ${CFL}
+.error ${.newline}'${cfl}' != ${.newline}'${CFL}'
+.endif
+
+.for a b in ${EMPTY}
+X!= echo 'a=$a b=$b' >&2; echo
+.endfor
+.endif
+
+.for a b in ${LIST} ${LIST:tu} ${XTRA_LIST}
+X!= echo 'a=$a b=$b' >&2; echo
+.endfor
+
+for-loop:
+ @echo We expect an error next:
+ @(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} for-fail) && \
+ { echo "Oops that should have failed!"; exit 1; } || echo OK