From b685746b126124dce7344776feae4ae24f035ecc Mon Sep 17 00:00:00 2001 From: Stephen Chang Date: Sun, 8 Sep 2013 02:00:16 -0400 Subject: [PATCH] add for/X tests for outer-loop #:final condition - make sure innermost loop is executed only one more time --- pkgs/racket-pkgs/racket-test/tests/racket/for.rktl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/racket-pkgs/racket-test/tests/racket/for.rktl b/pkgs/racket-pkgs/racket-test/tests/racket/for.rktl index 7695fdcd43..dcd4102c21 100644 --- a/pkgs/racket-pkgs/racket-test/tests/racket/for.rktl +++ b/pkgs/racket-pkgs/racket-test/tests/racket/for.rktl @@ -383,10 +383,16 @@ (define-sequence-syntax in-X* (lambda () #'in-X) (lambda (stx) #f)) (for/list ([x (in-X* #:x '(1 2 3))]) x))) + +;; extra tests for #:break and #:final (test '((0 0) (0 1) (1 0) (1 1)) 'multi-level-break (for*/list ([i 4] [j 2] #:break (= i 2)) (list i j))) (test '((1 0 0) (1 0 1) (1 1 0) (1 1 1)) 'multi-level-break (for/list ([i 5] #:when (odd? i) [j 2] #:when #t [k 2] #:break (= i 3)) (list i j k))) +(test '((0 0) (0 1) (1 0) (1 1) (2 0)) 'outer-loop-final + (for*/list ([i 4][j 2] #:final (= i 2)) (list i j))) +(test '((0 0) (0 1) (1 0) (1 1) (2 0)) 'outer-loop-final + (for/list ([i 4] #:final (= i 2) [j 2]) (list i j))) (report-errs)