File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 126126 (check-equal? (source-read-language (string-source "#lang scribble/manual " )) 'scribble/manual )
127127 (check-equal? (source-read-language (string-source "#lang info " )) 'info )
128128 (check-equal? (source-read-language (string-source "#lang setup/infotab " )) 'setup/infotab )
129- (check-equal? (source-read-language (string-source "(void) " )) #false )))
129+ (check-equal? (source-read-language (string-source "(void) " )) #false ))
130+
131+ (test-case "source-can-expand? "
132+ ;; Valid racket code should expand successfully
133+ (check-true (source-can-expand? (string-source "#lang racket/base\n(define x 42) " )))
134+ (check-true (source-can-expand? (string-source "#lang racket\n(or 1 2 3) " )))
135+
136+ ;; Invalid racket code should not expand
137+ (check-false (source-can-expand? (string-source "#lang racket/base\n(if) " )))
138+ (check-false (source-can-expand? (string-source "#lang racket/base\n(define) " )))
139+
140+ ;; Modified sources should also be testable
141+ (define orig (string-source "#lang racket/base\n(define foo 42) " ))
142+ (define valid-mod (modified-source orig "#lang racket/base\n(define foo 43) " ))
143+ (define invalid-mod (modified-source orig "#lang racket/base\n(if) " ))
144+ (check-true (source-can-expand? valid-mod))
145+ (check-false (source-can-expand? invalid-mod))))
130146
131147
132148(define (source-expand code)
You can’t perform that action at this time.
0 commit comments