From 0842983363868982f6748325339a27485428f8f7 Mon Sep 17 00:00:00 2001 From: "Sunrim KIM (keen)" <3han5chou7@gmail.com> Date: Tue, 22 Jul 2014 21:35:03 +0900 Subject: [PATCH] add test for `for` --- contrib/20.for/CMakeLists.txt | 2 ++ contrib/20.for/t/test.scm | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 contrib/20.for/t/test.scm 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)))))