diff --git a/contrib/20.for/CMakeLists.txt b/contrib/20.for/CMakeLists.txt index ebe66a42..5e109d90 100644 --- a/contrib/20.for/CMakeLists.txt +++ b/contrib/20.for/CMakeLists.txt @@ -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) diff --git a/contrib/20.for/t/test.scm b/contrib/20.for/t/test.scm new file mode 100644 index 00000000..0f58ae4e --- /dev/null +++ b/contrib/20.for/t/test.scm @@ -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)))))