Skip to content

Commit 4e39ce6

Browse files
AlexKnauthsamth
authored andcommitted
Test for/last and for*/last
1 parent ad0d0de commit 4e39ce6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#lang typed/racket
2+
3+
(require typed/rackunit)
4+
5+
(check-equal? (for/last : (U String #f) ([i '(1 2 3 4 5)]
6+
#:when (even? i))
7+
(number->string i))
8+
"4")
9+
10+
(check-equal? (for/last ([i '()])
11+
(error "doesn't get here"))
12+
#f)
13+
14+
(check-equal? (for*/last : (U (List Integer Char) #f) ([i '(1 2)]
15+
[j "ab"])
16+
(list i j))
17+
(list 2 #\b))
18+
19+
(check-equal? (for*/last : (U (List Integer Integer) #f) ([i (in-range 5)]
20+
#:when (odd? i)
21+
[j (in-range 4)]
22+
#:unless (= i j))
23+
(list i j))
24+
(list 3 2))
25+

0 commit comments

Comments
 (0)