fix sorting bug in bytecode submodule table

This commit is contained in:
Matthew Flatt 2012-04-26 21:11:10 -06:00
parent f099eec2af
commit 393e8b90b2
2 changed files with 26 additions and 1 deletions

View File

@ -523,6 +523,31 @@
(dynamic-require p #f)
(test 'for-submod dynamic-require `(submod ,p main) 'has-submod))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Try various submodule combinations to test sorting:
(let ()
(define (try-submods l)
(define e `(module e racket/base
,@(for/list ([n l])
`(module+ ,n
(define name ',n)
(provide name)))))
(define fn (build-path (find-system-path 'temp-dir)
"has-submod.rkt"))
(define dir (build-path (find-system-path 'temp-dir)
"compiled"))
(define fn-zo (build-path dir "has-submod_rkt.zo"))
(unless (directory-exists? dir) (make-directory dir))
(with-output-to-file fn-zo
#:exists 'truncate
(lambda () (write (compile e))))
(for ([n l])
(test n dynamic-require `(submod ,fn ,n) 'name)))
(try-submods '(a b))
(try-submods '(xa xb))
(try-submods '(test main)))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -1836,7 +1836,7 @@ static int compare_modules(const void *_am, const void *_bm)
bs = SCHEME_BYTE_STR_VAL(b);
for (i = 0; (i < alen) && (i < blen); i++) {
if (as[i] != bs[1])
if (as[i] != bs[i])
return as[i] - bs[i];
}