Added a test for cross-module struct optimization.
This commit is contained in:
parent
4a8113eac6
commit
4e6fc3154b
|
@ -0,0 +1,5 @@
|
|||
#lang typed/scheme #:optimize
|
||||
|
||||
;; will be imported by cross-module-struct2
|
||||
(provide (struct-out x))
|
||||
(define-struct: x ((x : Integer)))
|
|
@ -0,0 +1,5 @@
|
|||
#lang typed/scheme #:optimize
|
||||
|
||||
(require (file "cross-module-struct.rkt") racket/unsafe/ops)
|
||||
(define a (make-x 1))
|
||||
(x-x a)
|
|
@ -0,0 +1,5 @@
|
|||
#lang typed/scheme #:optimize
|
||||
|
||||
;; will be imported by cross-module-struct2
|
||||
(provide (struct-out x))
|
||||
(define-struct: x ((x : Integer)))
|
|
@ -0,0 +1,5 @@
|
|||
#lang typed/scheme #:optimize
|
||||
|
||||
(require (file "cross-module-struct.rkt") racket/unsafe/ops)
|
||||
(define a (make-x 1))
|
||||
(unsafe-struct-ref a 0)
|
|
@ -15,7 +15,8 @@
|
|||
(match-lambda [(list 'define-values-for-syntax '() _ ...) #f] [_ #t])
|
||||
(cadddr
|
||||
(syntax->datum
|
||||
(parameterize ([current-namespace (make-base-namespace)])
|
||||
(parameterize ([current-namespace (make-base-namespace)]
|
||||
[read-accept-reader #t])
|
||||
(with-handlers
|
||||
([exn:fail? (lambda (exn)
|
||||
(printf "~a\n" (exn-message exn))
|
||||
|
@ -25,8 +26,12 @@
|
|||
(define (test gen)
|
||||
(let-values (((base name _) (split-path gen)))
|
||||
(or (regexp-match ".*~" name) ; we ignore backup files
|
||||
(equal? (read-and-expand gen)
|
||||
(read-and-expand (build-path base "../hand-optimized/" name)))
|
||||
(equal? (parameterize ([current-load-relative-directory
|
||||
(build-path here "generic")])
|
||||
(read-and-expand gen))
|
||||
(let ((hand-opt-dir (build-path here "hand-optimized")))
|
||||
(parameterize ([current-load-relative-directory hand-opt-dir])
|
||||
(read-and-expand (build-path hand-opt-dir name)))))
|
||||
(begin (printf "~a failed\n\n" name)
|
||||
#f))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user