diff --git a/Makefile b/Makefile index 0fe3572..d0a9949 100644 --- a/Makefile +++ b/Makefile @@ -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 + diff --git a/parse-bytecode-5.1.1.rkt b/parse-bytecode-5.1.1.rkt index e118610..50ca13c 100644 --- a/parse-bytecode-5.1.1.rkt +++ b/parse-bytecode-5.1.1.rkt @@ -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))] diff --git a/parse-bytecode.rkt b/parse-bytecode.rkt index 6095f07..b8526d3 100644 --- a/parse-bytecode.rkt +++ b/parse-bytecode.rkt @@ -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))]) \ No newline at end of file + (error 'parse-bytecode "Whalesong doesn't have a compatible parser for Racket ~a" (version))]) \ No newline at end of file diff --git a/tests/test-get-dependencies.rkt b/tests/test-get-dependencies.rkt index 44d58ef..3b86133 100644 --- a/tests/test-get-dependencies.rkt +++ b/tests/test-get-dependencies.rkt @@ -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 #<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<)) \ No newline at end of file +(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<))) \ No newline at end of file