diff --git a/drracket-core-lib/drracket/private/debug.rkt b/drracket-core-lib/drracket/private/debug.rkt index 96f299de7..aef5d7e9d 100644 --- a/drracket-core-lib/drracket/private/debug.rkt +++ b/drracket-core-lib/drracket/private/debug.rkt @@ -504,7 +504,7 @@ [(null? (cdr planet-version)) (format "~s" `(,(car planet-version) ?))] [else - (format "~s" `(,(car planet-version) ,(cadr planet-version)))])) + (format "~s" (list (car planet-version) (cadr planet-version)))])) (cons 'description (exn->trace exn)))] [else #f])) diff --git a/drracket-core-lib/drracket/private/eval-helpers-and-pref-init.rkt b/drracket-core-lib/drracket/private/eval-helpers-and-pref-init.rkt index c55010404..91fec8d40 100644 --- a/drracket-core-lib/drracket/private/eval-helpers-and-pref-init.rkt +++ b/drracket-core-lib/drracket/private/eval-helpers-and-pref-init.rkt @@ -43,8 +43,8 @@ (define (get-init-dir path/f) (cond [path/f - (let-values ([(base name dir?) (split-path path/f)]) - base)] + (define-values (base name dir?) (split-path path/f)) + base] [else (find-system-path 'home-dir)])) @@ -159,11 +159,11 @@ (if sd (list sd) null))]) (λ (p) (define skip-in-paths? (file-stamp-in-paths p no-dirs)) + (define pkg (path->pkg p #:cache path->pkg-cache)) (define skip-pkgs? - (let ([pkg (path->pkg p #:cache path->pkg-cache)]) - (and pkg - (not (set-member? open-pkgs pkg)) - (file-stamp-in-paths p (list (pkg-directory/use-cache pkg)))))) + (and pkg + (not (set-member? open-pkgs pkg)) + (file-stamp-in-paths p (list (pkg-directory/use-cache pkg))))) (log-drracket/cm-info "~a; skip? ~a ~a thd ~a" p (and skip-in-paths? #t) diff --git a/drracket-core-lib/drracket/private/honu-logo.rkt b/drracket-core-lib/drracket/private/honu-logo.rkt index 6ab357d4c..67f0dac6e 100644 --- a/drracket-core-lib/drracket/private/honu-logo.rkt +++ b/drracket-core-lib/drracket/private/honu-logo.rkt @@ -177,9 +177,9 @@ little-fin-bottom-y)) (define (add-dot path x y) - (let ([p (new dc-path%)]) - (send p ellipse (- x 2) (- y 2) 4 4) - (send path append p))) + (define p (new dc-path%)) + (send p ellipse (- x 2) (- y 2) 4 4) + (send path append p)) (define (same-side-add x1 y1 x2 y2 x3 y3 x4 y4) (send body-path curve-to x2 y2 x3 y3 x4 y4)) @@ -193,11 +193,12 @@ (add-dot body-path x3 y3)) (define (opposite-side-add x1 y1 x2 y2 x3 y3 x4 y4) - (let ([conv (lambda (x y) (values (+ (- x) body-width) y))]) - (let-values ([(cx1 cy1) (conv x1 y1)] - [(cx2 cy2) (conv x2 y2)] - [(cx3 cy3) (conv x3 y3)]) - (send body-path curve-to cx3 cy3 cx2 cy2 cx1 cy1)))) + (define (conv x y) + (values (+ (- x) body-width) y)) + (define-values (cx1 cy1) (conv x1 y1)) + (define-values (cx2 cy2) (conv x2 y2)) + (define-values (cx3 cy3) (conv x3 y3)) + (send body-path curve-to cx3 cy3 cx2 cy2 cx1 cy1)) (define (opposite-side-add/dot x1 y1 x2 y2 x3 y3 x4 y4) (let ([conv (lambda (x y) (values (+ (- x) body-width) y))]) diff --git a/drracket-core-lib/drracket/private/stack-checkpoint.rkt b/drracket-core-lib/drracket/private/stack-checkpoint.rkt index 655a8e045..dde0c6872 100644 --- a/drracket-core-lib/drracket/private/stack-checkpoint.rkt +++ b/drracket-core-lib/drracket/private/stack-checkpoint.rkt @@ -236,12 +236,12 @@ interesting-editor-editions) (define (add-editions-to-interesting-editors editions interesting-editor-editions) - (for ([edition (in-list editions)]) - (when edition - (match-define (cons wb edition-number) edition) - (define ed (weak-box-value wb)) - (when ed - (hash-set! interesting-editor-editions ed edition))))) + (for ([edition (in-list editions)] + #:when edition) + (match-define (cons wb edition-number) edition) + (define ed (weak-box-value wb)) + (when ed + (hash-set! interesting-editor-editions ed edition)))) (define (empty-viewable-stack? a-viewable-stack) (match-define (viewable-stack stack-items _ _ _ _) diff --git a/drracket-test/tests/drracket/private/drracket-test-util.rkt b/drracket-test/tests/drracket/private/drracket-test-util.rkt index 5fbc81640..e9140ce0e 100644 --- a/drracket-test/tests/drracket/private/drracket-test-util.rkt +++ b/drracket-test/tests/drracket/private/drracket-test-util.rkt @@ -301,7 +301,8 @@ (define (wait-for-button button) (not-on-eventspace-handler-thread 'wait-for-button) - (define wait-for-button-pred (lambda () (queue-callback/res (λ () (send button is-enabled?))))) + (define (wait-for-button-pred) + (queue-callback/res (λ () (send button is-enabled?)))) (poll-until wait-for-button-pred)) (define (push-button-and-wait button) @@ -326,84 +327,84 @@ "expected a non-empty list of regexps and strings for language, got: ~e" in-language-spec)) (not-on-eventspace-handler-thread 'set-language-level!) - (let ([drs-frame (fw:test:get-active-top-level-window)]) - (fw:test:menu-select "Language" "Choose Language…") - (define language-dialog (wait-for-new-frame drs-frame)) - (fw:test:set-radio-box-item! #rx"Other Languages") - (define language-choices - (find-labelled-windows #f hierarchical-list% (fw:test:get-active-top-level-window))) - (define (click-on-snip snip) - (define-values (x y) - (queue-callback/res (λ () - (define b1 (box 0)) - (define b2 (box 0)) - (define editor (send (send snip get-admin) get-editor)) - (define between-threshold (send editor get-between-threshold)) - (send editor get-snip-location snip b1 b2) - (define-values (gx gy) - (send editor editor-location-to-dc-location (unbox b1) (unbox b2))) - (define x (inexact->exact (floor (+ gx between-threshold 1)))) - (define y (inexact->exact (floor (+ gy between-threshold 1)))) - (values x y)))) - (fw:test:mouse-click 'left x y)) - - (define found-language? #f) - - (for ([language-choice (in-list language-choices)]) - (queue-callback/res (λ () (send language-choice focus))) - (let loop ([list-item language-choice] - [language-spec in-language-spec]) - (let* ([name (car language-spec)] - [which (queue-callback/res - (λ () - (filter (lambda (child) - (let* ([text (send (send child get-editor) get-text)] - [matches (or (and (regexp? name) (regexp-match name text)) - (and (string? name) (string=? name text)))]) - (and matches child))) - (send list-item get-items))))]) - (unless (null? which) - (unless (= 1 (length which)) - (error 'set-language-level! - "couldn't find language: ~e, double match ~e" - in-language-spec - name)) - (let ([next-item (car which)]) - (cond - [(null? (cdr language-spec)) - (when (is-a? next-item hierarchical-list-compound-item<%>) - (error 'set-language-level! - "expected no more languages after ~e, but still are, input ~e" - name - in-language-spec)) - (set! found-language? #t) - (click-on-snip (send next-item get-clickable-snip))] - [else - (unless (is-a? next-item hierarchical-list-compound-item<%>) - (error 'set-language-level! - "expected more languages after ~e, but got to end, input ~e" - name - in-language-spec)) - (unless (queue-callback/res (λ () (send next-item is-open?))) - (click-on-snip (send next-item get-arrow-snip))) - (loop next-item (cdr language-spec))])))))) - - (unless found-language? - (error 'set-language-level! "couldn't find language: ~e" in-language-spec)) - - (with-handlers ([exn:fail? (lambda (x) (void))]) - (fw:test:button-push #rx"Show Details")) - - (fw:test:button-push "Revert to Language Defaults") - - (when close-dialog? - (fw:test:button-push "OK") - (let ([new-frame (wait-for-new-frame language-dialog)]) - (unless (eq? new-frame drs-frame) - (error 'set-language-level! - "didn't get drracket frame back, got: ~s (drs-frame ~s)\n" - new-frame - drs-frame)))))) + (define drs-frame (fw:test:get-active-top-level-window)) + (fw:test:menu-select "Language" "Choose Language…") + (define language-dialog (wait-for-new-frame drs-frame)) + (fw:test:set-radio-box-item! #rx"Other Languages") + (define language-choices + (find-labelled-windows #f hierarchical-list% (fw:test:get-active-top-level-window))) + (define (click-on-snip snip) + (define-values (x y) + (queue-callback/res (λ () + (define b1 (box 0)) + (define b2 (box 0)) + (define editor (send (send snip get-admin) get-editor)) + (define between-threshold (send editor get-between-threshold)) + (send editor get-snip-location snip b1 b2) + (define-values (gx gy) + (send editor editor-location-to-dc-location (unbox b1) (unbox b2))) + (define x (inexact->exact (floor (+ gx between-threshold 1)))) + (define y (inexact->exact (floor (+ gy between-threshold 1)))) + (values x y)))) + (fw:test:mouse-click 'left x y)) + + (define found-language? #f) + + (for ([language-choice (in-list language-choices)]) + (queue-callback/res (λ () (send language-choice focus))) + (let loop ([list-item language-choice] + [language-spec in-language-spec]) + (let* ([name (car language-spec)] + [which (queue-callback/res + (λ () + (filter (lambda (child) + (let* ([text (send (send child get-editor) get-text)] + [matches (or (and (regexp? name) (regexp-match name text)) + (and (string? name) (string=? name text)))]) + (and matches child))) + (send list-item get-items))))]) + (unless (null? which) + (unless (= 1 (length which)) + (error 'set-language-level! + "couldn't find language: ~e, double match ~e" + in-language-spec + name)) + (let ([next-item (car which)]) + (cond + [(null? (cdr language-spec)) + (when (is-a? next-item hierarchical-list-compound-item<%>) + (error 'set-language-level! + "expected no more languages after ~e, but still are, input ~e" + name + in-language-spec)) + (set! found-language? #t) + (click-on-snip (send next-item get-clickable-snip))] + [else + (unless (is-a? next-item hierarchical-list-compound-item<%>) + (error 'set-language-level! + "expected more languages after ~e, but got to end, input ~e" + name + in-language-spec)) + (unless (queue-callback/res (λ () (send next-item is-open?))) + (click-on-snip (send next-item get-arrow-snip))) + (loop next-item (cdr language-spec))])))))) + + (unless found-language? + (error 'set-language-level! "couldn't find language: ~e" in-language-spec)) + + (with-handlers ([exn:fail? (lambda (x) (void))]) + (fw:test:button-push #rx"Show Details")) + + (fw:test:button-push "Revert to Language Defaults") + + (when close-dialog? + (fw:test:button-push "OK") + (let ([new-frame (wait-for-new-frame language-dialog)]) + (unless (eq? new-frame drs-frame) + (error 'set-language-level! + "didn't get drracket frame back, got: ~s (drs-frame ~s)\n" + new-frame + drs-frame))))) (define (set-module-language! [close-dialog? #t]) (not-on-eventspace-handler-thread 'set-module-language!) @@ -476,25 +477,25 @@ (cond [(<= end pos) #f] [else - (let ([snip (send interactions-text find-snip pos 'after-or-none)]) - (cond - [(not snip) #f] - [else - (let ([color (send (send snip get-style) get-foreground)]) - (if (and (= 255 (send color red)) (= 0 (send color blue) (send color green))) - - ;; return the text of the entire line containing the red text - (let ([para (send interactions-text position-paragraph pos)]) - (unless (exact-nonnegative-integer? para) - (error 'has-error? - "got back a bad result from position-paragraph: ~s ~s\n" - para - (list pos (send interactions-text last-position)))) - (send interactions-text get-text - (send interactions-text paragraph-start-position para) - (send interactions-text paragraph-end-position para))) - - (loop (+ pos (send snip get-count)))))]))]))))) + (define snip (send interactions-text find-snip pos 'after-or-none)) + (cond + [(not snip) #f] + [else + (let ([color (send (send snip get-style) get-foreground)]) + (if (and (= 255 (send color red)) (= 0 (send color blue) (send color green))) + + ;; return the text of the entire line containing the red text + (let ([para (send interactions-text position-paragraph pos)]) + (unless (exact-nonnegative-integer? para) + (error 'has-error? + "got back a bad result from position-paragraph: ~s ~s\n" + para + (list pos (send interactions-text last-position)))) + (send interactions-text get-text + (send interactions-text paragraph-start-position para) + (send interactions-text paragraph-end-position para))) + + (loop (+ pos (send snip get-count)))))])]))))) (define fetch-output (case-lambda @@ -524,52 +525,45 @@ (let loop ([snip (send text find-snip end 'before)] [strings null]) (cond - [(or (not snip) - (< (send text get-snip-position snip) start)) + [(or (not snip) (< (send text get-snip-position snip) start)) (apply string-append strings)] + [(is-a? snip string-snip%) + (loop (send snip previous) + (cons (send snip get-text 0 (send snip get-count)) strings))] + [(is-a? snip editor-snip%) + (let ([editor (send snip get-editor)]) + (cond + [(is-a? editor pasteboard%) + (loop (send snip previous) (cons "" strings))] + [(is-a? editor text%) + (loop (send snip previous) + (list* "{embedded \"" + (fetch-text-content editor 0 (send editor last-position)) + "\"}" + strings))]))] + [(is-a? snip image-snip%) + (loop (send snip previous) + (cons (with-handlers ([exn:fail? (lambda (x) "{image}")]) + (format "{~a}" (send snip get-image-name))) + strings))] + + [;; this test is an approximation of + ;; (is-a? snip drscheme:snip:number-snip%) + (and (method-in-interface? 'get-fraction-view (object-interface snip))) + (loop (send snip previous) + (cons (format "{number ~s ~s ~s}" + (send snip get-number) + (send snip get-text 0 (send snip get-count)) + (send snip get-fraction-view)) + strings))] + [;; this test is an approximation of + ;; (is-a? snip pict-snip%) from drracket/private/pict-snip% + (let ([sc (send snip get-snipclass)]) + (and sc (regexp-match #rx"pict-snip.rkt" (send sc get-classname)))) + (loop (send snip previous) (cons "{pict-snip}" strings))] + [else - (cond - [(is-a? snip string-snip%) - (loop (send snip previous) - (cons (send snip get-text 0 (send snip get-count)) strings))] - [(is-a? snip editor-snip%) - (let ([editor (send snip get-editor)]) - (cond - [(is-a? editor pasteboard%) - (loop (send snip previous) - (cons "" strings))] - [(is-a? editor text%) - (loop (send snip previous) - (list* "{embedded \"" - (fetch-text-content editor 0 (send editor last-position)) - "\"}" - strings))]))] - [(is-a? snip image-snip%) - (loop (send snip previous) - (cons (with-handlers ([exn:fail? (lambda (x) "{image}")]) - (format "{~a}" (send snip get-image-name))) - strings))] - - [;; this test is an approximation of - ;; (is-a? snip drscheme:snip:number-snip%) - (and (method-in-interface? 'get-fraction-view (object-interface snip))) - (loop (send snip previous) - (cons (format "{number ~s ~s ~s}" - (send snip get-number) - (send snip get-text 0 (send snip get-count)) - (send snip get-fraction-view)) - strings))] - [;; this test is an approximation of - ;; (is-a? snip pict-snip%) from drracket/private/pict-snip% - (let ([sc (send snip get-snipclass)]) - (and sc (regexp-match #rx"pict-snip.rkt" (send sc get-classname)))) - (loop (send snip previous) - (cons "{pict-snip}" strings))] - - [else - (loop (send snip previous) - (cons (format "{unknown snip: ~e}\n" snip) - strings))])]))) + (loop (send snip previous) (cons (format "{unknown snip: ~e}\n" snip) strings))]))) (fetch-text-content (send frame get-interactions-text) start end)))])) @@ -604,32 +598,30 @@ #:prefs [prefs '()] run-test) (on-eventspace-handler-thread 'fire-up-drracket-and-run-tests) - (let () - (use-hash-for-prefs fw:preferences:low-level-get-preference - fw:preferences:low-level-put-preferences - fw:preferences:restore-defaults - fw:preferences:set - fw:preferences:default-set? - prefs) - - (parameterize ([current-command-line-arguments #()]) - (dynamic-require 'drracket #f)) - - (fw:test:use-focus-table use-focus-table?) - - (thread (λ () - (let ([orig-display-handler (error-display-handler)]) - (uncaught-exception-handler - (λ (x) - (if (exn? x) - (orig-display-handler (exn-message x) x) - (eprintf "uncaught exception ~s\n" x)) - (sleep/yield 0.1) - (exit 1)))) - (run-test) - (test-log #:display? #t #:exit? #t) - (exit 0))) - (yield (make-semaphore 0)))) + (use-hash-for-prefs fw:preferences:low-level-get-preference + fw:preferences:low-level-put-preferences + fw:preferences:restore-defaults + fw:preferences:set + fw:preferences:default-set? + prefs) + + (parameterize ([current-command-line-arguments #()]) + (dynamic-require 'drracket #f)) + + (fw:test:use-focus-table use-focus-table?) + + (thread (λ () + (let ([orig-display-handler (error-display-handler)]) + (uncaught-exception-handler (λ (x) + (if (exn? x) + (orig-display-handler (exn-message x) x) + (eprintf "uncaught exception ~s\n" x)) + (sleep/yield 0.1) + (exit 1)))) + (run-test) + (test-log #:display? #t #:exit? #t) + (exit 0))) + (yield (make-semaphore 0))) (define (wait-for-online-compilation-to-finish frame) (let loop ([i 0]) diff --git a/drracket-test/tests/drracket/private/easter-egg-lib.rkt b/drracket-test/tests/drracket/private/easter-egg-lib.rkt index cc1d8ddff..2096d71fc 100644 --- a/drracket-test/tests/drracket/private/easter-egg-lib.rkt +++ b/drracket-test/tests/drracket/private/easter-egg-lib.rkt @@ -81,15 +81,12 @@ and then loading the framework after that. (define (wait-for-drracket-frame [print-message? #f]) (define (wait-for-drracket-frame-pred) (define active (test:get-active-top-level-window)) - (if (and active - (drracket-frame? active)) - active - #f)) + (and (and active (drracket-frame? active)) active)) (define drr-fr (or (wait-for-drracket-frame-pred) (begin (when print-message? - (printf "Select DrRacket frame\n")) + (displayln "Select DrRacket frame")) (poll-until wait-for-drracket-frame-pred)))) (when drr-fr (wait-for-events-in-frame-eventspace drr-fr)) @@ -113,10 +110,9 @@ and then loading the framework after that. (define (verify-drracket-frame-frontmost function-name frame) (on-eventspace-handler-thread 'verify-drracket-frame-frontmost) - (let ([tl (test:get-active-top-level-window)]) - (unless (and (eq? frame tl) - (drracket-frame? tl)) - (error function-name "drracket frame not frontmost: ~e (found ~e)" frame tl)))) + (define tl (test:get-active-top-level-window)) + (unless (and (eq? frame tl) (drracket-frame? tl)) + (error function-name "drracket frame not frontmost: ~e (found ~e)" frame tl))) (define (set-module-language! drr-frame) (test:menu-select "Language" "Choose Language…") diff --git a/drracket-test/tests/drracket/private/module-lang-test-utils.rkt b/drracket-test/tests/drracket/private/module-lang-test-utils.rkt index 8c3f2c5ac..bba395eb6 100644 --- a/drracket-test/tests/drracket/private/module-lang-test-utils.rkt +++ b/drracket-test/tests/drracket/private/module-lang-test-utils.rkt @@ -106,32 +106,29 @@ (define output-start-paragraph 2) (when ints - (let ([after-execute-output - (queue-callback/res - (λ () - (send interactions-text - get-text - (send interactions-text paragraph-start-position 2) - (send interactions-text paragraph-end-position 2))))]) - (unless (or (test-all? test) (string=? "> " after-execute-output)) - (eprintf (string-append - "FAILED (line ~a): ~a\n" - " ~a\n" - " expected no output after execution, got: ~s\n") - (test-line test) - (test-definitions test) - (or (test-interactions test) 'no-interactions) - after-execute-output) - (k (void))) - (insert-in-interactions drs ints) - ;; set to be the paragraph right after the insertion. - (set! output-start-paragraph - (queue-callback/res - (λ () (+ (send interactions-text position-paragraph - (send interactions-text last-position)) - 1)))) - (test:keystroke #\return '(alt)) - (wait-for-computation drs))) + (define after-execute-output + (queue-callback/res (λ () + (send interactions-text get-text + (send interactions-text paragraph-start-position 2) + (send interactions-text paragraph-end-position 2))))) + (unless (or (test-all? test) (string=? "> " after-execute-output)) + (eprintf (string-append "FAILED (line ~a): ~a\n" + " ~a\n" + " expected no output after execution, got: ~s\n") + (test-line test) + (test-definitions test) + (or (test-interactions test) 'no-interactions) + after-execute-output) + (k (void))) + (insert-in-interactions drs ints) + ;; set to be the paragraph right after the insertion. + (set! output-start-paragraph + (queue-callback/res (λ () + (+ (send interactions-text position-paragraph + (send interactions-text last-position)) + 1)))) + (test:keystroke #\return '(alt)) + (wait-for-computation drs)) (define text (queue-callback/res @@ -155,13 +152,10 @@ (let loop ([snip (send interactions-text find-first-snip)]) (cond [(not snip) '()] - [else - (cond - [(method-in-interface? 'get-stacks (object-interface snip)) - (define-values (s1 s2) (send snip get-stacks)) - (list* s1 s2 (loop (send snip next)))] - [else - (loop (send snip next))])]))))) + [(method-in-interface? 'get-stacks (object-interface snip)) + (define-values (s1 s2) (send snip get-stacks)) + (list* s1 s2 (loop (send snip next)))] + [else (loop (send snip next))]))))) (define output-passed? (let ([r (if separate-process? (test-separate-process-result test) @@ -179,23 +173,23 @@ text) (unless (null? stacks) (eprintf "stacks from error message:\n") - (for ([stack (in-list stacks)]) - (when stack - (eprintf "\n----\n") - (unless (empty-viewable-stack? stack) - (define stack-iterator (copy-viewable-stack stack)) - (let loop () - (define-values (list-of-srcloc-count has-next?) - (viewable-stack-get-next-items! stack-iterator)) - (for ([srcloc-count (in-list list-of-srcloc-count)]) - (define frame (srcloc->string (car srcloc-count))) - (define count (+ 1 (cdr srcloc-count))) - (if (> count 1) - (eprintf " ~a [repeated ~a times]\n" frame count) - (eprintf " ~a\n" frame))) - (when has-next? - (loop)))) - (eprintf "----\n"))))) + (for ([stack (in-list stacks)] + #:when stack) + (eprintf "\n----\n") + (unless (empty-viewable-stack? stack) + (define stack-iterator (copy-viewable-stack stack)) + (let loop () + (define-values (list-of-srcloc-count has-next?) + (viewable-stack-get-next-items! stack-iterator)) + (for ([srcloc-count (in-list list-of-srcloc-count)]) + (define frame (srcloc->string (car srcloc-count))) + (define count (+ 1 (cdr srcloc-count))) + (if (> count 1) + (eprintf " ~a [repeated ~a times]\n" frame count) + (eprintf " ~a\n" frame))) + (when has-next? + (loop)))) + (eprintf "----\n")))) (define the-assert (test-extra-assert test)) (define-values (kws-req kws-acc) (procedure-keywords the-assert)) (define-values (kws kw-vals) diff --git a/drracket-test/tests/drracket/private/repl-test.rkt b/drracket-test/tests/drracket/private/repl-test.rkt index b32ea059e..e886a6608 100644 --- a/drracket-test/tests/drracket/private/repl-test.rkt +++ b/drracket-test/tests/drracket/private/repl-test.rkt @@ -1097,7 +1097,8 @@ This produces an ACK message (- (send defs-text get-start-position) 1) (- (send defs-text get-start-position) 1))))] [(pair? item) (apply test:menu-select item)])) - program)]) + program)] + [else (void)]) (do-execute drr-frame #f) @@ -1130,20 +1131,20 @@ This produces an ACK message (eprintf "FAILED execute test for ~s\n expected interactions to have the focus\n" program))] [defs-focus? - (let ([start (car source-location)] - [finish (cdr source-location)]) - (let* ([error-ranges (queue-callback/res (λ () (send ints-text get-error-ranges)))] - [error-range (and error-ranges (not (null? error-ranges)) (car error-ranges))]) - (unless (and error-range - (= (+ (srcloc-position error-range) -1) (loc-offset start)) - (= (+ (srcloc-position error-range) -1 (srcloc-span error-range)) - (loc-offset finish))) - (eprintf "FAILED execute test for ~s\n error-range is ~s\n expected ~s\n" - program - (and error-range - (list (+ (srcloc-position error-range) -1) - (+ (srcloc-position error-range) -1 (srcloc-span error-range)))) - (list (loc-offset start) (loc-offset finish))))))])]) + (define start (car source-location)) + (define finish (cdr source-location)) + (define error-ranges (queue-callback/res (λ () (send ints-text get-error-ranges)))) + (define error-range (and error-ranges (not (null? error-ranges)) (car error-ranges))) + (unless (and error-range + (= (+ (srcloc-position error-range) -1) (loc-offset start)) + (= (+ (srcloc-position error-range) -1 (srcloc-span error-range)) + (loc-offset finish))) + (eprintf "FAILED execute test for ~s\n error-range is ~s\n expected ~s\n" + program + (and error-range + (list (+ (srcloc-position error-range) -1) + (+ (srcloc-position error-range) -1 (srcloc-span error-range)))) + (list (loc-offset start) (loc-offset finish))))])]) ; check text for execute test (next-test) @@ -1192,21 +1193,21 @@ This produces an ACK message (test:run-one (λ () (send (send drr-frame get-break-button) command)))) (wait-for-drr-frame-computation) - (let* ([load-text-end (- (get-int-pos) 1)] ;; subtract one to eliminate newline - [received-load (fetch-output drr-frame load-text-start load-text-end)]) - - ;; check load text - (next-test) - (unless (cond - [(string? load-answer) (string=? load-answer received-load)] - [(regexp? load-answer) (regexp-match load-answer received-load)] - [else #f]) - (failure) - (eprintf "FAILED load test ~a for ~s\n expected: ~s\n got: ~s\n" - short-filename - program - load-answer - received-load)))) + (define load-text-end (- (get-int-pos) 1)) ;; subtract one to eliminate newline + (define received-load (fetch-output drr-frame load-text-start load-text-end)) + + ;; check load text + (next-test) + (unless (cond + [(string? load-answer) (string=? load-answer received-load)] + [(regexp? load-answer) (regexp-match load-answer received-load)] + [else #f]) + (failure) + (eprintf "FAILED load test ~a for ~s\n expected: ~s\n got: ~s\n" + short-filename + program + load-answer + received-load))) (load-test tmp-load-short-filename (make-load-answer in-vector language-cust #f)) (when (file-exists? tmp-load3-filename) (delete-file tmp-load3-filename))