diff --git a/collects/tests/drracket/example-tool.rkt b/collects/tests/drracket/example-tool.rkt index 959e89b712..7ee8bc05e7 100644 --- a/collects/tests/drracket/example-tool.rkt +++ b/collects/tests/drracket/example-tool.rkt @@ -29,4 +29,6 @@ (cons new-collection-root (current-library-collection-paths))]) - (namespace-require 'tests/drracket/private/run-example-tool)) + (namespace-require 'tests/drracket/private/run-example-tool) + (eval '(go))) + diff --git a/collects/tests/drracket/private/run-example-tool.rkt b/collects/tests/drracket/private/run-example-tool.rkt index b434854f19..82a157ca18 100644 --- a/collects/tests/drracket/private/run-example-tool.rkt +++ b/collects/tests/drracket/private/run-example-tool.rkt @@ -20,61 +20,64 @@ framework/test mrlib/switchable-button) -(define init-options@ - (unit (import setup-option^) - (export) - (make-zo #f) - (make-launchers #f) - (make-docs #f) - (call-install #f) - (call-post-install #f) - (setup-program-name "raco setup") - (specific-collections '(("coll"))))) - -(let ([c (make-custodian)]) - (parameterize ([current-custodian c] - [exit-handler - (λ (x) - (custodian-shutdown-all c))]) - (invoke-unit - (compound-unit - (import) - (export) - (link - [((OPTIONS : setup-option^)) setup:option@] - [() init-options@ OPTIONS] - [((LAUNCHER : launcher^)) launcher@] - [((COMPILER-OPTION : compiler:option^)) compiler:option@] - [((DYNEXT-COMPILE : dynext:compile^)) dynext:compile@] - [((DYNEXT-FILE : dynext:file^)) dynext:file@] - [((DYNEXT-LINK : dynext:link^)) dynext:link@] - [((COMPILER : compiler^)) compiler@ COMPILER-OPTION DYNEXT-FILE DYNEXT-COMPILE DYNEXT-LINK] - [() setup@ LAUNCHER OPTIONS COMPILER-OPTION COMPILER DYNEXT-FILE]))))) - -(fire-up-drscheme-and-run-tests - (λ () - (define drs (wait-for-drscheme-frame)) - (queue-callback/res (λ () (send (send drs get-definitions-canvas) focus))) - (for ([x (in-string "egg\r1\r2\r3")]) - ;; need #\r to actually get newlines in the editor - ;; see test:keystroke docs - (test:keystroke x)) - - (queue-callback/res - (λ () - (define btn - (for/or ([x (in-list (send (send drs get-button-panel) get-children))]) - (and (is-a? x switchable-button%) - (equal? (send x get-button-label) "Reverse Definitions") - x))) - (send btn command))) - - (define content - (queue-callback/res (λ () (send (send drs get-definitions-text) get-text)))) - (define expected (apply string (reverse (string->list "easter egg\n1\n2\n3")))) - (unless (equal? content expected) - (fprintf (current-error-port) - "example-tool.rkt: test failed;\nexpected ~s\n but got ~s" - expected - content)))) +(provide go) +(define (go) + + (define init-options@ + (unit (import setup-option^) + (export) + (make-zo #f) + (make-launchers #f) + (make-docs #f) + (call-install #f) + (call-post-install #f) + (setup-program-name "raco setup") + (specific-collections '(("coll"))))) + + (let ([c (make-custodian)]) + (parameterize ([current-custodian c] + [exit-handler + (λ (x) + (custodian-shutdown-all c))]) + (invoke-unit + (compound-unit + (import) + (export) + (link + [((OPTIONS : setup-option^)) setup:option@] + [() init-options@ OPTIONS] + [((LAUNCHER : launcher^)) launcher@] + [((COMPILER-OPTION : compiler:option^)) compiler:option@] + [((DYNEXT-COMPILE : dynext:compile^)) dynext:compile@] + [((DYNEXT-FILE : dynext:file^)) dynext:file@] + [((DYNEXT-LINK : dynext:link^)) dynext:link@] + [((COMPILER : compiler^)) compiler@ COMPILER-OPTION DYNEXT-FILE DYNEXT-COMPILE DYNEXT-LINK] + [() setup@ LAUNCHER OPTIONS COMPILER-OPTION COMPILER DYNEXT-FILE]))))) + + (fire-up-drscheme-and-run-tests + (λ () + (define drs (wait-for-drscheme-frame)) + (queue-callback/res (λ () (send (send drs get-definitions-canvas) focus))) + (for ([x (in-string "egg\r1\r2\r3")]) + ;; need #\r to actually get newlines in the editor + ;; see test:keystroke docs + (test:keystroke x)) + + (queue-callback/res + (λ () + (define btn + (for/or ([x (in-list (send (send drs get-button-panel) get-children))]) + (and (is-a? x switchable-button%) + (equal? (send x get-button-label) "Reverse Definitions") + x))) + (send btn command))) + + (define content + (queue-callback/res (λ () (send (send drs get-definitions-text) get-text)))) + (define expected (apply string (reverse (string->list "easter egg\n1\n2\n3")))) + (unless (equal? content expected) + (fprintf (current-error-port) + "example-tool.rkt: test failed;\nexpected ~s\n but got ~s" + expected + content))))) \ No newline at end of file