-
Notifications
You must be signed in to change notification settings - Fork 11
/
tests-5.1-req.scm
86 lines (80 loc) · 2.5 KB
/
tests-5.1-req.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!eof
(add-tests-with-string-output "tokenizer"
[(let ()
(define test-tokenizer
(lambda (p)
;(display (input-port? p) (standard-error-port))
(let ([tok (read-token p)])
(cond
[(eof-object? tok) 'ok]
[(or (eq? tok 'lparen)
(eq? tok 'rparen)
(eq? tok 'vparen)
(eq? tok 'lbrack)
(eq? tok 'rbrack)
(eq? tok 'dot)
(and (pair? tok)
(or (eq? (car tok) 'datum)
(eq? (car tok) 'macro))))
(test-tokenizer p)]
[else
(display tok)
(error 'test "Invalid token ~s" tok)]))))
(define test-file
(lambda (filename)
(display "Testing " (standard-error-port))
(display filename (standard-error-port))
(display "..." (standard-error-port))
(let ([p (open-input-file filename)])
; (display (input-port? p)(standard-error-port))
(test-tokenizer p))))
(define test-files
(lambda (files)
(unless (null? files)
(test-file (car files))
(test-files (cdr files)))))
(define filenames
'("libsymboltable-4.4.ss"
"libhandlers-3.3.ss"
"libcore-4.4.ss"
"libio-4.2.ss"
"libwriter-4.4.ss"
"libtokenizer-4.3.ss"
"compiler-5.1.ss"))
(when (null? filenames)
(error 'no-files-provided-in-test "add them"))
(test-files filenames)
'ok) => "ok\n"]
)
(add-tests-with-string-output "reader"
[(let ()
(define test-reader
(lambda (p)
(let ([x (read p)])
(cond
[(eof-object? x) 'ok]
[else (test-reader p)]))))
(define test-file
(lambda (filename)
(display "Testing " (standard-error-port))
(display filename (standard-error-port))
(display "..." (standard-error-port))
(test-reader (open-input-file filename))))
(define test-files
(lambda (files)
(unless (null? files)
(test-file (car files))
(test-files (cdr files)))))
(define filenames
'("libsymboltable-4.4.ss"
"libhandlers-3.3.ss"
"libcore-4.4.ss"
"libio-4.2.ss"
"libwriter-4.4.ss"
"libtokenizer-4.3.ss"
"compiler-5.1.ss"))
(when (null? filenames)
(error 'no-files-provided-in-test "add them"))
(test-files filenames)
'ok) => "ok\n"]
)