Skip to content

Commit 897fb2f

Browse files
Copilotjackfirth
andcommitted
Add error handling to check-suite-analysis for better robustness
Co-authored-by: jackfirth <[email protected]>
1 parent af3bd38 commit 897fb2f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/private/rackunit.rkt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,22 @@
267267
(define all-analyzers
268268
(set-union (refactoring-suite-analyzers suite) extra-analyzers))
269269

270+
(define (skip e)
271+
(log-resyntax-error
272+
"skipping analysis\n encountered an error during macro expansion\n error:\n~a"
273+
(string-indent (exn-message e) #:amount 3))
274+
(syntax-property-bundle))
275+
270276
(define actual-props
271277
(call-with-logs-captured
272278
(λ ()
273279
(define full-source (source->string program-src))
274280
(if (string-prefix? full-source "#lang racket")
275-
(source-code-analysis-added-syntax-properties
276-
(source-analyze program-src #:analyzers all-analyzers))
281+
(with-handlers ([exn:fail:syntax? skip]
282+
[exn:fail:filesystem:missing-module? skip]
283+
[exn:fail:contract:variable? skip])
284+
(source-code-analysis-added-syntax-properties
285+
(source-analyze program-src #:analyzers all-analyzers)))
277286
(syntax-property-bundle)))))
278287

279288
(define target-src (string-source (string-trim (code-block-raw-string target))))

0 commit comments

Comments
 (0)