fixing tests for get-dependencies

This commit is contained in:
Danny Yoo 2011-05-20 11:07:30 -04:00
parent 66e63ddb2c
commit b1b3f5aaa2
4 changed files with 53 additions and 39 deletions

View File

@ -1,13 +1,19 @@
test-all:
raco make -v --disable-inline tests/test-all.rkt
racket tests/test-all.rkt
test-compiler: test-compiler:
raco make -v --disable-inline test-compiler.rkt raco make -v --disable-inline tests/test-compiler.rkt
racket test-compiler.rkt racket tests/test-compiler.rkt
test-earley: test-earley:
raco make -v --disable-inline test-earley.rkt raco make -v --disable-inline tests/test-earley.rkt
racket test-earley.rkt racket tests/test-earley.rkt
test-conform: test-conform:
raco make -v --disable-inline test-conform.rkt raco make -v --disable-inline tests/test-conform.rkt
racket test-conform.rkt racket tests/test-conform.rkt

View File

@ -194,7 +194,8 @@
(let ([rewritten-path (rewrite-path resolved-path-name)]) (let ([rewritten-path (rewrite-path resolved-path-name)])
(cond (cond
[(symbol? rewritten-path) [(symbol? rewritten-path)
(make-ModuleName (rewrite-path resolved-path-name) resolved-path-name)] (make-ModuleName (rewrite-path resolved-path-name)
(normalize-path resolved-path-name))]
[else [else
(error 'wrap-module-name "Unable to resolve module path ~s" resolved-path-name)]))])) (error 'wrap-module-name "Unable to resolve module path ~s" resolved-path-name)]))]))
@ -261,7 +262,8 @@
(let ([rewritten-path (rewrite-path resolved-path)]) (let ([rewritten-path (rewrite-path resolved-path)])
(cond (cond
[(symbol? rewritten-path) [(symbol? rewritten-path)
(make-Require (make-ModuleName rewritten-path resolved-path))] (make-Require (make-ModuleName rewritten-path
(normalize-path resolved-path)))]
[else [else
(printf "Internal error: I don't know how to handle the require for ~s" require-statement) (printf "Internal error: I don't know how to handle the require for ~s" require-statement)
(error 'parse-req)]))] (error 'parse-req)]))]
@ -348,7 +350,8 @@
(cond (cond
[(symbol? rewritten-path) [(symbol? rewritten-path)
(make-Module name (make-Module name
(make-ModuleName rewritten-path self-path) (make-ModuleName rewritten-path
(normalize-path self-path))
(parse-prefix prefix) (parse-prefix prefix)
(parse-mod-requires self-modidx requires) (parse-mod-requires self-modidx requires)
(parse-mod-body body))] (parse-mod-body body))]

View File

@ -6,6 +6,6 @@
[(version>= (version) "5.1.1") [(version>= (version) "5.1.1")
(begin (begin
(require "parse-bytecode-5.1.1.rkt") (require "parse-bytecode-5.1.1.rkt")
(provide parse-bytecode))] (provide (all-from-out "parse-bytecode-5.1.1.rkt")))]
[else [else
(error 'parse-bytecode "Currently no compatible parser for Racket ~a" (version))]) (error 'parse-bytecode "Whalesong doesn't have a compatible parser for Racket ~a" (version))])

View File

@ -9,14 +9,10 @@
(define-runtime-path compiler-path "..") (define-runtime-path compiler-path "..")
(define e
(parse-bytecode (build-path compiler-path "get-dependencies.rkt")))
(void (get-dependencies e))
(void (get-dependencies ;(printf "This is the path: ~s\n"
(parse-bytecode ; (path->string (normalize-path compiler-path)))
(build-path ;(flush-output)
"/home/dyoo/local/racket-5.1.1/lib/racket/collects/scheme/base.rkt"))))
@ -38,26 +34,35 @@
(define e
(parse-bytecode (build-path compiler-path "get-dependencies.rkt")))
(void (get-dependencies e))
(void (get-dependencies
(parse-bytecode
(build-path collects-dir "scheme" "base.rkt"))))
;; This should have three dependencies: racket/base, racket/match, and get-module-bytecode. ;; This should have three dependencies: racket/base, racket/match, and get-module-bytecode.
(check-equal? (let ([ip (open-input-string
(sort (get-dependencies (parse-bytecode (format (string-append "(module foo racket/base (require racket/math "
(open-input-bytes "(file \"~a/get-module-bytecode.rkt\")) (exp 1))")
(get-module-bytecode (path->string (normalize-path compiler-path))))])
(open-input-string (format #<<EOF
(module foo racket/base (check-equal? (sort (get-dependencies (parse-bytecode
(require racket/math (open-input-bytes
(file "~a/get-module-bytecode.rkt")) (get-module-bytecode ip))))
(exp 1)) module-name<)
EOF
(path->string (normalize-path compiler-path))) (sort
))))) (list (make-ModuleName 'collects/racket/base.rkt
module-name<) (normalize-path (build-path collects-dir "racket" "base.rkt")))
(sort (make-ModuleName 'collects/racket/math.rkt
(list (make-ModuleName 'collects/racket/base.rkt (normalize-path (build-path collects-dir "racket" "math.rkt")))
(build-path collects-dir "racket" "base.rkt")) (make-ModuleName 'whalesong/get-module-bytecode.rkt
(make-ModuleName 'collects/racket/math.rkt (normalize-path (build-path compiler-path "get-module-bytecode.rkt"))))
(build-path collects-dir "racket" "math.rkt")) module-name<)))
(make-ModuleName 'whalesong/get-module-bytecode.rkt
(normalize-path (build-path compiler-path "get-module-bytecode.rkt"))))
module-name<))