add test for `for`

This commit is contained in:
Sunrim KIM (keen) 2014-07-22 21:35:03 +09:00
parent 561cfc9816
commit 0842983363
2 changed files with 15 additions and 0 deletions

View File

@ -1,2 +1,4 @@
file(GLOB FOR_FILES ${PROJECT_SOURCE_DIR}/contrib/20.for/piclib/*.scm)
list(APPEND PICLIB_CONTRIB_LIBS ${FOR_FILES})
add_custom_target(test-for for test in ${PROJECT_SOURCE_DIR}/contrib/20.for/t/*.scm \; do bin/picrin "$$test" \; done DEPENDS repl)
set(CONTRIB_TESTS ${CONTRIB_TESTS} test-for)

13
contrib/20.for/t/test.scm Normal file
View File

@ -0,0 +1,13 @@
(import (scheme base)
(picrin control list)
(picrin test))
(test '(1 2 3)
(for
(yield (in '(1 2 3)))))
(test '((1 a) (1 b) (1 c) (2 a) (2 b) (2 c) (3 a) (3 b) (3 c))
(for
(let ((n (in '(1 2 3)))
(c (in '(a b c))))
(yield (list n c)))))