adjusted the module-language, pretty-big and r5rs parts of

the drracket language test for the new error messages
This commit is contained in:
Robby Findler 2012-06-01 02:36:00 -05:00
parent d17f93db30
commit 7118547c58

View File

@ -62,7 +62,7 @@ the settings above should match r5rs
(test-expression "(define-struct spider (legs))(make-spider 4)" (test-expression "(define-struct spider (legs))(make-spider 4)"
"#<spider>" "#<spider>"
"define-values: cannot re-define a constant: struct:spider") #rx"define-values: cannot re-define a constant.*struct:spider")
(test-expression "(sqrt -1)" "0+1i") (test-expression "(sqrt -1)" "0+1i")
@ -72,9 +72,9 @@ the settings above should match r5rs
(test-expression "(define (. x y) (* x y))" #rx"read: illegal use of \"\\.\"" "") (test-expression "(define (. x y) (* x y))" #rx"read: illegal use of \"\\.\"" "")
(test-expression "'(1 . 2)" "'(1 . 2)") (test-expression "'(1 . 2)" "'(1 . 2)")
(test-expression "(define (f define) 1)" "" "define-values: cannot re-define a constant: f") (test-expression "(define (f define) 1)" "" #rx"define-values: cannot re-define a constant.*: f")
(test-expression "(define (f car) 1)" "" "define-values: cannot re-define a constant: f") (test-expression "(define (f car) 1)" "" #rx"define-values: cannot re-define a constant.*: f")
(test-expression "(define (f empty) 1)" "" "define-values: cannot re-define a constant: f") (test-expression "(define (f empty) 1)" "" #rx"define-values: cannot re-define a constant.*: f")
(test-expression "call/cc" "#<procedure:call-with-current-continuation>") (test-expression "call/cc" "#<procedure:call-with-current-continuation>")
@ -87,19 +87,19 @@ the settings above should match r5rs
(test-expression "true" "#t") (test-expression "true" "#t")
(test-expression "mred^" (test-expression "mred^"
#rx"unbound identifier in module in: mred\\^" #rx"unbound identifier in module in: mred\\^"
#rx"reference to undefined identifier: mred\\^") #rx"reference to undefined identifier.*: mred\\^")
(test-expression "(eq? 'a 'A)" "#f") (test-expression "(eq? 'a 'A)" "#f")
(test-expression "(set! x 1)" (test-expression "(set! x 1)"
#rx"set!: unbound identifier in module in: x" #rx"set!: unbound identifier in module in: x"
#rx"set!: cannot set undefined variable: x") #rx"set!: cannot set undefined.*: x")
(test-expression "(define qqq 2) (set! qqq 1)" "") (test-expression "(define qqq 2) (set! qqq 1)" "")
(test-expression "(cond [(= 1 2) 3])" "") (test-expression "(cond [(= 1 2) 3])" "")
(test-expression "(cons 1 2)" "'(1 . 2)") (test-expression "(cons 1 2)" "'(1 . 2)")
(test-expression "(+ (list 1) 2)" (regexp (regexp-quote "+: expects type <number> as 1st argument, given: '(1); other arguments were: 2"))) (test-expression "(+ (list 1) 2)" #rx"[+]: contract violation.*given: '[(]1[)]")
(test-expression "'(1)" "'(1)") (test-expression "'(1)" "'(1)")
(test-expression "(define shrd (box 1)) (list shrd shrd)" (test-expression "(define shrd (box 1)) (list shrd shrd)"
"'(#&1 #&1)" "'(#&1 #&1)"
"define-values: cannot re-define a constant: shrd") #rx"define-values: cannot re-define a constant.*: shrd")
(test-expression "(local ((define x x)) 1)" "1") (test-expression "(local ((define x x)) 1)" "1")
(test-expression "(letrec ([x x]) 1)" "1") (test-expression "(letrec ([x x]) 1)" "1")
(test-expression "(if 1 1 1)" "1") (test-expression "(if 1 1 1)" "1")
@ -125,12 +125,12 @@ the settings above should match r5rs
(test-expression ",1" "{stop-22x22.png} unquote: not in quasiquote in: (unquote 1)") (test-expression ",1" "{stop-22x22.png} unquote: not in quasiquote in: (unquote 1)")
(test-expression "(list 1)" "'(1)") (test-expression "(list 1)" "'(1)")
(test-expression "(car (list))" "{stop-multi.png} {stop-22x22.png} car: expects argument of type <pair>; given: '()") (test-expression "(car (list))" #rx"{stop-multi.png} {stop-22x22.png} car: contract violation.*given: '[(][)]")
(test-expression "(current-command-line-arguments)" "'#()") (test-expression "(current-command-line-arguments)" "'#()")
(test-expression "(define-syntax app syntax-case)" "{stop-22x22.png} syntax-case: bad syntax in: syntax-case") (test-expression "(define-syntax app syntax-case)" "{stop-22x22.png} syntax-case: bad syntax in: syntax-case")
(test-expression "#lang racket" "" #rx"read: #lang not enabled in the current context") (test-expression "#lang racket" #rx"read: #lang not enabled in the current context" "")
(test-expression "(define (f)\n(+ (raise-user-error 'a \"b\")))\n(if (zero? (random 1)) (void) (set! f void))\n(f)" (test-expression "(define (f)\n(+ (raise-user-error 'a \"b\")))\n(if (zero? (random 1)) (void) (set! f void))\n(f)"
"a: b"))) "a: b")))
@ -192,13 +192,13 @@ the settings above should match r5rs
#rx"cpu time: [0-9]+ real time: [0-9]+ gc time: [0-9]+\n1") #rx"cpu time: [0-9]+ real time: [0-9]+ gc time: [0-9]+\n1")
(test-expression "true" "#t") (test-expression "true" "#t")
(test-expression "mred^" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: mred^") (test-expression "mred^" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: mred\\^")
(test-expression "(eq? 'a 'A)" "#f") (test-expression "(eq? 'a 'A)" "#f")
(test-expression "(set! x 1)" "{stop-multi.png} {stop-22x22.png} set!: cannot set undefined variable: x") (test-expression "(set! x 1)" #rx"{stop-multi.png} {stop-22x22.png} set!: cannot set undefined.*: x")
(test-expression "(define qqq 2) (set! qqq 1)" "") (test-expression "(define qqq 2) (set! qqq 1)" "")
(test-expression "(cond [(= 1 2) 3])" "") (test-expression "(cond [(= 1 2) 3])" "")
(test-expression "(cons 1 2)" "(1 . 2)") (test-expression "(cons 1 2)" "(1 . 2)")
(test-expression "(+ (list 1) 2)" "{stop-multi.png} {stop-22x22.png} +: expects type <number> as 1st argument, given: (1); other arguments were: 2") (test-expression "(+ (list 1) 2)" #rx"{stop-multi.png} {stop-22x22.png} [+]: contract violation.*given: [(]1[)]")
(test-expression "'(1)" "(1)") (test-expression "'(1)" "(1)")
(test-expression "(define shrd (box 1)) (list shrd shrd)" (test-expression "(define shrd (box 1)) (list shrd shrd)"
"(#&1 #&1)") "(#&1 #&1)")
@ -227,7 +227,7 @@ the settings above should match r5rs
(test-expression ",1" "{stop-22x22.png} unquote: not in quasiquote in: (unquote 1)") (test-expression ",1" "{stop-22x22.png} unquote: not in quasiquote in: (unquote 1)")
(test-expression "(list 1)" "(1)") (test-expression "(list 1)" "(1)")
(test-expression "(car (list))" "{stop-multi.png} {stop-22x22.png} car: expects argument of type <pair>; given: ()") (test-expression "(car (list))" #rx"{stop-multi.png} {stop-22x22.png} car: contract violation.*given: [(][)]")
(test-expression "(current-command-line-arguments)" "#()") (test-expression "(current-command-line-arguments)" "#()")
(test-expression "(define-syntax app syntax-case)" "{stop-22x22.png} syntax-case: bad syntax in: syntax-case") (test-expression "(define-syntax app syntax-case)" "{stop-22x22.png} syntax-case: bad syntax in: syntax-case")
@ -274,12 +274,12 @@ the settings above should match r5rs
(test-expression (test-expression
"(define-struct spider (legs))(make-spider 4)" "(define-struct spider (legs))(make-spider 4)"
"{stop-multi.png} {stop-22x22.png} reference to undefined identifier: define-struct") #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: define-struct")
(test-expression "(sqrt -1)" "0+1i") (test-expression "(sqrt -1)" "0+1i")
(test-expression "class" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: class") (test-expression "class" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: class")
(test-expression "shared" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: shared") (test-expression "shared" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: shared")
(test-expression "(define (. x y) (* x y))" #rx"read: illegal use of \"\\.\"") (test-expression "(define (. x y) (* x y))" #rx"read: illegal use of \"\\.\"")
(test-expression "'(1 . 2)" "(1 . 2)") (test-expression "'(1 . 2)" "(1 . 2)")
@ -288,22 +288,22 @@ the settings above should match r5rs
(test-expression "(define (f car) 1)" "") (test-expression "(define (f car) 1)" "")
(test-expression "(define (f empty) 1)" "") (test-expression "(define (f empty) 1)" "")
(test-expression "call/cc" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: call/cc") (test-expression "call/cc" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: call/cc")
(test-expression "(error 'a \"~a\" 1)" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: error") (test-expression "(error 'a \"~a\" 1)" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: error")
(test-expression "(error \"a\" \"a\")" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: error") (test-expression "(error \"a\" \"a\")" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: error")
(test-expression "(time 1)" (test-expression "(time 1)"
"{stop-multi.png} {stop-22x22.png} reference to undefined identifier: time") #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: time")
(test-expression "true" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: true") (test-expression "true" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: true")
(test-expression "mred^" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: mred^") (test-expression "mred^" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: mred\\^")
(test-expression "(eq? 'a 'A)" "#t") (test-expression "(eq? 'a 'A)" "#t")
(test-expression "(set! x 1)" "{stop-multi.png} {stop-22x22.png} set!: cannot set undefined variable: x") (test-expression "(set! x 1)" #rx"{stop-multi.png} {stop-22x22.png} set!: cannot set undefined.*: x")
(test-expression "(define qqq 2) (set! qqq 1)" "") (test-expression "(define qqq 2) (set! qqq 1)" "")
(test-expression "(cond ((= 1 2) 3))" "") (test-expression "(cond ((= 1 2) 3))" "")
(test-expression "(cons 1 2)" "(1 . 2)") (test-expression "(cons 1 2)" "(1 . 2)")
(test-expression "(+ (list 1) 2)" "{stop-multi.png} {stop-22x22.png} +: expects type <number> as 1st argument, given: (1); other arguments were: 2") (test-expression "(+ (list 1) 2)" #rx"{stop-multi.png} {stop-22x22.png} [+]: contract violation.*given: [(]1[)]")
(test-expression "'(1)" "(1)") (test-expression "'(1)" "(1)")
(test-expression "(define shrd (cons 1 1)) (list shrd shrd)" (test-expression "(define shrd (cons 1 1)) (list shrd shrd)"
"((1 . 1) (1 . 1))") "((1 . 1) (1 . 1))")
@ -328,16 +328,16 @@ the settings above should match r5rs
(test-expression "+1/2i" "0+1/2i") (test-expression "+1/2i" "0+1/2i")
(test-expression "779625/32258" "{number 779625/32258 \"24 5433/32258\" mixed}") (test-expression "779625/32258" "{number 779625/32258 \"24 5433/32258\" mixed}")
(test-expression "(exact? 1.5)" "#f") (test-expression "(exact? 1.5)" "#f")
(test-expression "(print (floor (sqrt 2)))" #rx"reference to undefined identifier: print") (test-expression "(print (floor (sqrt 2)))" #rx"reference to undefined identifier.*: print")
(test-expression "(let ((f (lambda (x) x))) f)" "#<procedure:f>") (test-expression "(let ((f (lambda (x) x))) f)" "#<procedure:f>")
(test-expression ",1" "{stop-22x22.png} unquote: not in quasiquote in: (unquote 1)") (test-expression ",1" "{stop-22x22.png} unquote: not in quasiquote in: (unquote 1)")
(test-expression "(list 1)" "(1)") (test-expression "(list 1)" "(1)")
(test-expression "(car (list))" (test-expression "(car (list))"
"{stop-multi.png} {stop-22x22.png} mcar: expects argument of type <mutable-pair>; given: ()") #rx"{stop-multi.png} {stop-22x22.png} mcar: contract violation.*given: [(][)]")
(test-expression "argv" "{stop-multi.png} {stop-22x22.png} reference to undefined identifier: argv") (test-expression "argv" #rx"{stop-multi.png} {stop-22x22.png} reference to undefined identifier.*: argv")
(test-expression "(define-syntax app syntax-case)" (test-expression "(define-syntax app syntax-case)"
"{stop-22x22.png} macro-transformer: only a `syntax-rules' form is allowed in: syntax-case") "{stop-22x22.png} macro-transformer: only a `syntax-rules' form is allowed in: syntax-case")
@ -1173,6 +1173,7 @@ the settings above should match r5rs
(eprintf "expected lines: \n ~a\n ~a\ngot lines:\n ~a\n ~a\n" (eprintf "expected lines: \n ~a\n ~a\ngot lines:\n ~a\n ~a\n"
line0-expect line1-expect line0-expect line1-expect
line0-got line1-got) line0-got line1-got)
(eprintf "defs: ~s" (queue-callback/res (λ () (send (send drs get-definitions-text) get-text))))
(error 'language-test.rkt "failed get top of repl test"))))) (error 'language-test.rkt "failed get top of repl test")))))