made module lang tests Windows friendly & Rackety

This commit is contained in:
Robby Findler 2010-12-20 07:58:50 -06:00
parent dfe6e37ffd
commit 53509bef5f

View File

@ -1,4 +1,4 @@
#lang at-exp scheme/gui #lang at-exp racket/gui
(require "module-lang-test-utils.rkt") (require "module-lang-test-utils.rkt")
(provide run-test) (provide run-test)
@ -18,9 +18,9 @@
(number? (syntax-e (syntax thing))) (number? (syntax-e (syntax thing)))
(syntax/loc stx (#%datum . thing))])) (syntax/loc stx (#%datum . thing))]))
(provide #%module-begin [rename bug-datum #%datum])) (provide #%module-begin [rename bug-datum #%datum]))
(module module-lang-test-tmp4 scheme/base (module module-lang-test-tmp4 racket/base
(/ 888 2) (/ 888 2)
(provide (except-out (all-from-out scheme/base) #%top-interaction)))) (provide (except-out (all-from-out racket/base) #%top-interaction))))
(test @t{} (test @t{}
#f #f
@ -33,7 +33,7 @@
@rx{Module Language: only a module expression is allowed @rx{Module Language: only a module expression is allowed
Interactions disabled} Interactions disabled}
#t) #t)
(test @t{(module m mzscheme) 1} (test @t{(module m racket) 1}
#f #f
@rx{Module Language: there can only be one expression in the definitions @rx{Module Language: there can only be one expression in the definitions
Interactions disabled} Interactions disabled}
@ -55,20 +55,20 @@
collection not found collection not found
Interactions disabled} Interactions disabled}
#t) #t)
(test @t{#lang scheme (test @t{#lang racket
3} 3}
#f #f
"3") "3")
(test @t{(module m mzscheme (provide x) (define x 1))} (test @t{(module m racket (provide x) (define x 1))}
@t{x} @t{x}
"1") "1")
(test @t{(module m mzscheme (define x 1))} (test @t{(module m racket (define x 1))}
@t{x} @t{x}
"1") "1")
(test @t{(module m mzscheme (define x 1) (define y 1) (provide y))} (test @t{(module m racket (define x 1) (define y 1) (provide y))}
@t{x} @t{x}
"1") "1")
(test @t{(module m mzscheme (define x 1) (define y 2) (provide y))} (test @t{(module m racket (define x 1) (define y 2) (provide y))}
@t{y} @t{y}
"2") "2")
(test @t{(module m mzscheme (require mzlib/list))} (test @t{(module m mzscheme (require mzlib/list))}
@ -154,7 +154,7 @@
(define-syntax app (syntax-rules () ((app . x) '(app . x)))))} (define-syntax app (syntax-rules () ((app . x) '(app . x)))))}
@t{x} @t{x}
"2") "2")
(test @t{#lang scheme (test @t{#lang racket
(eval 'cons)} (eval 'cons)}
#f #f
@rx{. compile: unbound identifier \(and no #%top syntax transformer is bound\) in: cons}) @rx{. compile: unbound identifier \(and no #%top syntax transformer is bound\) in: cons})
@ -164,14 +164,14 @@
;; check that we have a working repl in the right language after ;; check that we have a working repl in the right language after
;; syntax errors, unless it's a bad language ;; syntax errors, unless it's a bad language
(test @t{#lang scheme (test @t{#lang racket
(define x 1) (define x 1)
(define y (/ 0))} (define y (/ 0))}
@t{(+ 122 x)} @t{(+ 122 x)}
@rx{. /: division by zero @rx{. /: division by zero
123} 123}
#t) #t)
(test @t{#lang scheme (test @t{#lang racket
(define x 1) (define x 1)
(define y (/ 0))} (define y (/ 0))}
@t{(if x 123)} @t{(if x 123)}
@ -208,7 +208,6 @@
(* x 123))} (* x 123))}
#f #f
@rx{cannot open input file @rx{cannot open input file
No such file or directory
Module Language: invalid language specification Module Language: invalid language specification
Interactions disabled} Interactions disabled}
#t) #t)
@ -218,43 +217,41 @@
"\nInteractions disabled: setup/infotab does not support a REPL (no #%top-interaction)" "\nInteractions disabled: setup/infotab does not support a REPL (no #%top-interaction)"
#t) #t)
;; test scheme/load behavior ;; test racket/load behavior
(test @t{#lang scheme/load (test @t{#lang racket/load
(module m mzscheme (provide x) (define x 2)) (module m mzscheme (provide x) (define x 2))
(require 'm) (require 'm)
(printf "~s\n" x) (printf "~s\n" x)
(flush-output)} (flush-output)}
#f #f
"2") "2")
(test @t{#lang scheme/load (test @t{#lang racket/load
(module m mzscheme (provide x) (define x 2)) (module m mzscheme (provide x) (define x 2))
(module n scheme/base (require 'm) (provide y) (define y (* x x))) (module n racket/base (require 'm) (provide y) (define y (* x x)))
(require 'n) (require 'n)
(printf "~s\n" y) (printf "~s\n" y)
(flush-output)} (flush-output)}
#f #f
"4") "4")
(test @t{#lang scheme (test @t{#lang racket
(define-syntax (f stx) (define-syntax (f stx)
(syntax-case stx () (syntax-case stx ()
[(f) [(f)
(raise (make-exn:fail:syntax "both" (current-continuation-marks) (list #'f stx)))]))} (raise (make-exn:fail:syntax "both" (current-continuation-marks) (list #'f stx)))]))}
@t{(f)} @t{(f)}
#<<-- (string-append "> (f)\n"
> (f) ". both in:\n"
. both in: " f\n"
f " (f)")
(f)
--
#t) #t)
;; test protection against user-code changing the namespace ;; test protection against user-code changing the namespace
(test @t{#lang scheme/base (test @t{#lang racket/base
(current-namespace (make-base-namespace))} (current-namespace (make-base-namespace))}
"(+ 1 2)" "(+ 1 2)"
"3") "3")
(test @t{#lang scheme/base (test @t{#lang racket/base
(current-namespace (make-base-empty-namespace))} (current-namespace (make-base-empty-namespace))}
"(+ 1 2)" "(+ 1 2)"
"3") "3")