-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#lang info | ||
(define name "syntax-warn-test") | ||
(define collection "warn") | ||
(define deps | ||
'("syntax-warn")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#lang racket/base/warn | ||
|
||
(require (for-syntax syntax/parse | ||
syntax/parse/define) | ||
rackunit | ||
racket/format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#lang racket/base/warn | ||
|
||
(require rackunit | ||
(for-syntax syntax/parse | ||
syntax/parse/define) | ||
racket/format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,43 @@ | ||
#lang racket/base/warn | ||
#lang racket/base | ||
|
||
(require rackunit | ||
(for-syntax syntax/parse | ||
syntax/parse/define) | ||
racket/format) | ||
(require racket/system) | ||
|
||
(module+ test | ||
(require rackunit | ||
warn/private/rackunit-string)) | ||
|
||
|
||
(struct system-result (code stdout stderr) #:transparent) | ||
|
||
(define (system/result system-str) | ||
(define stdout-str-port (open-output-string)) | ||
(define stderr-str-port (open-output-string)) | ||
(define exit-code | ||
(parameterize ([current-output-port stdout-str-port] | ||
[current-error-port stderr-str-port]) | ||
(system/exit-code system-str))) | ||
(define stdout (get-output-string stdout-str-port)) | ||
(define stderr (get-output-string stderr-str-port)) | ||
(system-result exit-code stdout stderr)) | ||
|
||
(define (run-warn-command collect) | ||
(system/result (format "raco warn -c ~a" collect))) | ||
|
||
(module+ test | ||
(test-case "Checking a module with no warnings" | ||
(define result (run-warn-command "warn/test-no-warnings")) | ||
(check-equal? (system-result-code result) 0) | ||
(check-string-contains? (system-result-stdout result) | ||
"Checking 1 module\n") | ||
(check-equal? (system-result-stderr result) "")) | ||
(test-case "Checking a module with warnings" | ||
(define result (run-warn-command "warn/test-warnings")) | ||
(check-equal? (system-result-code result) 1) | ||
(check-equal? (system-result-stderr result) "") | ||
(check-string-contains-all? (system-result-stdout result) | ||
(list "Checking 1 module\n" | ||
"syntax-warn-test/test-warnings/main.rkt" | ||
"phase order" | ||
"suggested fix" | ||
"require" | ||
"for-syntax")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters