Add 'for' iterator and 'if-let' syntax
This commit is contained in:
13
test.scm
13
test.scm
@@ -32,6 +32,19 @@
|
||||
(negative-case
|
||||
(assert (unspecified? (when-not #t 'do-some-stuff 'return)))))
|
||||
|
||||
(define-test for
|
||||
(permutation
|
||||
(define value (for ([i (iota 2)]
|
||||
[j (iota 2)])
|
||||
(cons i j)))
|
||||
(assert (equal? value '((0 . 0) (0 . 1) (1 . 0) (1 . 1))))))
|
||||
|
||||
(define-test if-let
|
||||
(positive-case
|
||||
(assert (= (if-let ([v (or #f 1)]) (+ v 1)) 2)))
|
||||
(negative-case
|
||||
(assert (not (if-let ([v (and #f 1)]) (+ v 1))))))
|
||||
|
||||
(define-test partial
|
||||
(test
|
||||
(define value (partial / 2))
|
||||
|
||||
Reference in New Issue
Block a user