diff --git a/collects/tests/racket/submodule.rktl b/collects/tests/racket/submodule.rktl index ee252da35d..86b32eee45 100644 --- a/collects/tests/racket/submodule.rktl +++ b/collects/tests/racket/submodule.rktl @@ -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) diff --git a/src/racket/src/print.c b/src/racket/src/print.c index 443883686f..24bf70a418 100644 --- a/src/racket/src/print.c +++ b/src/racket/src/print.c @@ -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]; }