File tree Expand file tree Collapse file tree 14 files changed +99
-14
lines changed Expand file tree Collapse file tree 14 files changed +99
-14
lines changed Original file line number Diff line number Diff line change 4
4
"../interp-defun.rkt "
5
5
"../interp-io.rkt " )
6
6
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])))
Original file line number Diff line number Diff line change 248
248
(check-equal? (run '(match (box 1 ) [(box x) x] [_ 2 ]))
249
249
1 )
250
250
251
- ;; Loot examples
251
+ ;; Loot examples
252
+ (check-true (procedure? (run '(λ (x) x))))
252
253
(check-equal? (run '((λ (x) x) 5 ))
253
254
5 )
254
255
Original file line number Diff line number Diff line change 30
30
(string)
31
31
(build-string (heap-ref i)
32
32
(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. " ))]))
34
37
35
38
(define (untag i)
36
39
(arithmetic-shift (arithmetic-shift i (- (integer-length ptr-mask)))
Original file line number Diff line number Diff line change 4
4
"../interp-defun.rkt "
5
5
"../interp-io.rkt " )
6
6
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])))
Original file line number Diff line number Diff line change 248
248
(check-equal? (run '(match (box 1 ) [(box x) x] [_ 2 ]))
249
249
1 )
250
250
251
- ;; Loot examples
251
+ ;; Loot examples
252
+ (check-true (procedure? (run '(λ (x) x))))
252
253
(check-equal? (run '((λ (x) x) 5 ))
253
254
5 )
254
255
Original file line number Diff line number Diff line change 37
37
(string)
38
38
(build-string (heap-ref i)
39
39
(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. " ))]))
41
44
42
45
(define (untag i)
43
46
(arithmetic-shift (arithmetic-shift i (- (integer-length ptr-mask)))
Original file line number Diff line number Diff line change 4
4
"../interp-defun.rkt "
5
5
"../interp-io.rkt " )
6
6
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])))
Original file line number Diff line number Diff line change 248
248
(check-equal? (run '(match (box 1 ) [(box x) x] [_ 2 ]))
249
249
1 )
250
250
251
- ;; Loot examples
251
+ ;; Loot examples
252
+ (check-true (procedure? (run '(λ (x) x))))
252
253
(check-equal? (run '((λ (x) x) 5 ))
253
254
5 )
254
255
Original file line number Diff line number Diff line change 37
37
(string)
38
38
(build-string (heap-ref i)
39
39
(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
+
41
45
42
46
(define (untag i)
43
47
(arithmetic-shift (arithmetic-shift i (- (integer-length ptr-mask)))
Original file line number Diff line number Diff line change 4
4
"../interp-defun.rkt "
5
5
"../interp-io.rkt " )
6
6
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])))
You can’t perform that action at this time.
0 commit comments