Skip to content

Commit fc31655

Browse files
committed
Closes #108.
1 parent ce080a4 commit fc31655

14 files changed

+99
-14
lines changed

langs/loot/test/interp-defun.rkt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,21 @@
44
"../interp-defun.rkt"
55
"../interp-io.rkt")
66

7-
(test-runner (λ p (interp (parse p))))
8-
(test-runner-io (λ (s . p) (interp/io (parse p) s)))
7+
(define (closure->proc xs e r)
8+
;; Could make this better by calling the interpreter,
9+
;; but it's only used in tests where all we care about
10+
;; is that you get a procedure.
11+
(lambda _
12+
(error "This function is not callable.")))
13+
14+
(test-runner
15+
(λ p
16+
(match (interp (parse p))
17+
[(Closure xs e r) (closure->proc xs e r)]
18+
[v v])))
19+
(test-runner-io
20+
(λ (s . p)
21+
(match (interp/io (parse p) s)
22+
[(cons (Closure xs e r) o)
23+
(cons (closure->proc xs e r) o)]
24+
[r r])))

langs/loot/test/test-runner.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@
248248
(check-equal? (run '(match (box 1) [(box x) x] [_ 2]))
249249
1)
250250

251-
;; Loot examples
251+
;; Loot examples
252+
(check-true (procedure? (run '(λ (x) x))))
252253
(check-equal? (run '((λ (x) x) 5))
253254
5)
254255

langs/loot/unload-bits-asm.rkt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
(string)
3131
(build-string (heap-ref i)
3232
(lambda (j)
33-
(char-ref (+ i 8) j))))]))
33+
(char-ref (+ i 8) j))))]
34+
[(? proc-bits? i)
35+
(lambda _
36+
(error "This function is not callable."))]))
3437

3538
(define (untag i)
3639
(arithmetic-shift (arithmetic-shift i (- (integer-length ptr-mask)))

langs/mountebank/test/interp-defun.rkt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,21 @@
44
"../interp-defun.rkt"
55
"../interp-io.rkt")
66

7-
(test-runner (λ p (interp (parse p))))
8-
(test-runner-io (λ (s . p) (interp/io (parse p) s)))
7+
(define (closure->proc xs e r)
8+
;; Could make this better by calling the interpreter,
9+
;; but it's only used in tests where all we care about
10+
;; is that you get a procedure.
11+
(lambda _
12+
(error "This function is not callable.")))
13+
14+
(test-runner
15+
(λ p
16+
(match (interp (parse p))
17+
[(Closure xs e r) (closure->proc xs e r)]
18+
[v v])))
19+
(test-runner-io
20+
(λ (s . p)
21+
(match (interp/io (parse p) s)
22+
[(cons (Closure xs e r) o)
23+
(cons (closure->proc xs e r) o)]
24+
[r r])))

langs/mountebank/test/test-runner.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@
248248
(check-equal? (run '(match (box 1) [(box x) x] [_ 2]))
249249
1)
250250

251-
;; Loot examples
251+
;; Loot examples
252+
(check-true (procedure? (run '(λ (x) x))))
252253
(check-equal? (run '((λ (x) x) 5))
253254
5)
254255

langs/mountebank/unload-bits-asm.rkt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
(string)
3838
(build-string (heap-ref i)
3939
(lambda (j)
40-
(char-ref (+ i 8) j)))))]))
40+
(char-ref (+ i 8) j)))))]
41+
[(? proc-bits? i)
42+
(lambda _
43+
(error "This function is not callable."))]))
4144

4245
(define (untag i)
4346
(arithmetic-shift (arithmetic-shift i (- (integer-length ptr-mask)))

langs/mug/test/interp-defun.rkt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,21 @@
44
"../interp-defun.rkt"
55
"../interp-io.rkt")
66

7-
(test-runner (λ p (interp (parse p))))
8-
(test-runner-io (λ (s . p) (interp/io (parse p) s)))
7+
(define (closure->proc xs e r)
8+
;; Could make this better by calling the interpreter,
9+
;; but it's only used in tests where all we care about
10+
;; is that you get a procedure.
11+
(lambda _
12+
(error "This function is not callable.")))
13+
14+
(test-runner
15+
(λ p
16+
(match (interp (parse p))
17+
[(Closure xs e r) (closure->proc xs e r)]
18+
[v v])))
19+
(test-runner-io
20+
(λ (s . p)
21+
(match (interp/io (parse p) s)
22+
[(cons (Closure xs e r) o)
23+
(cons (closure->proc xs e r) o)]
24+
[r r])))

langs/mug/test/test-runner.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@
248248
(check-equal? (run '(match (box 1) [(box x) x] [_ 2]))
249249
1)
250250

251-
;; Loot examples
251+
;; Loot examples
252+
(check-true (procedure? (run '(λ (x) x))))
252253
(check-equal? (run '((λ (x) x) 5))
253254
5)
254255

langs/mug/unload-bits-asm.rkt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
(string)
3838
(build-string (heap-ref i)
3939
(lambda (j)
40-
(char-ref (+ i 8) j)))))]))
40+
(char-ref (+ i 8) j)))))]
41+
[(? proc-bits? i)
42+
(lambda _
43+
(error "This function is not callable."))]))
44+
4145

4246
(define (untag i)
4347
(arithmetic-shift (arithmetic-shift i (- (integer-length ptr-mask)))

langs/neerdowell/test/interp-defun.rkt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,21 @@
44
"../interp-defun.rkt"
55
"../interp-io.rkt")
66

7-
(test-runner (λ p (interp (parse p))))
8-
(test-runner-io (λ (s . p) (interp/io (parse p) s)))
7+
(define (closure->proc xs e r)
8+
;; Could make this better by calling the interpreter,
9+
;; but it's only used in tests where all we care about
10+
;; is that you get a procedure.
11+
(lambda _
12+
(error "This function is not callable.")))
13+
14+
(test-runner
15+
(λ p
16+
(match (interp (parse p))
17+
[(Closure xs e r) (closure->proc xs e r)]
18+
[v v])))
19+
(test-runner-io
20+
(λ (s . p)
21+
(match (interp/io (parse p) s)
22+
[(cons (Closure xs e r) o)
23+
(cons (closure->proc xs e r) o)]
24+
[r r])))

0 commit comments

Comments
 (0)