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:
raco make -v --disable-inline test-compiler.rkt
racket test-compiler.rkt
raco make -v --disable-inline tests/test-compiler.rkt
racket tests/test-compiler.rkt
test-earley:
raco make -v --disable-inline test-earley.rkt
racket test-earley.rkt
raco make -v --disable-inline tests/test-earley.rkt
racket tests/test-earley.rkt
test-conform:
raco make -v --disable-inline test-conform.rkt
racket test-conform.rkt
raco make -v --disable-inline tests/test-conform.rkt
racket tests/test-conform.rkt

View File

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

View File

@ -6,6 +6,6 @@
[(version>= (version) "5.1.1")
(begin
(require "parse-bytecode-5.1.1.rkt")
(provide parse-bytecode))]
(provide (all-from-out "parse-bytecode-5.1.1.rkt")))]
[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 e
(parse-bytecode (build-path compiler-path "get-dependencies.rkt")))
(void (get-dependencies e))
(void (get-dependencies
(parse-bytecode
(build-path
"/home/dyoo/local/racket-5.1.1/lib/racket/collects/scheme/base.rkt"))))
;(printf "This is the path: ~s\n"
; (path->string (normalize-path compiler-path)))
;(flush-output)
@ -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.
(check-equal?
(sort (get-dependencies (parse-bytecode
(open-input-bytes
(get-module-bytecode
(open-input-string (format #<<EOF
(module foo racket/base
(require racket/math
(file "~a/get-module-bytecode.rkt"))
(exp 1))
EOF
(path->string (normalize-path compiler-path)))
)))))
module-name<)
(sort
(list (make-ModuleName 'collects/racket/base.rkt
(build-path collects-dir "racket" "base.rkt"))
(make-ModuleName 'collects/racket/math.rkt
(build-path collects-dir "racket" "math.rkt"))
(make-ModuleName 'whalesong/get-module-bytecode.rkt
(normalize-path (build-path compiler-path "get-module-bytecode.rkt"))))
module-name<))
(let ([ip (open-input-string
(format (string-append "(module foo racket/base (require racket/math "
"(file \"~a/get-module-bytecode.rkt\")) (exp 1))")
(path->string (normalize-path compiler-path))))])
(check-equal? (sort (get-dependencies (parse-bytecode
(open-input-bytes
(get-module-bytecode ip))))
module-name<)
(sort
(list (make-ModuleName 'collects/racket/base.rkt
(normalize-path (build-path collects-dir "racket" "base.rkt")))
(make-ModuleName 'collects/racket/math.rkt
(normalize-path (build-path collects-dir "racket" "math.rkt")))
(make-ModuleName 'whalesong/get-module-bytecode.rkt
(normalize-path (build-path compiler-path "get-module-bytecode.rkt"))))
module-name<)))