From bf4ffac4b920c4d2d753f24a95bf122779a59f77 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 01/10] Fix 4 occurrences of `cond-let-to-cond-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- .../private/eval-helpers-and-pref-init.rkt | 4 +- .../drracket/private/syncheck-debug.rkt | 6 +-- .../drracket/private/drracket-test-util.rkt | 38 +++++++++---------- .../tests/drracket/private/repl-test.rkt | 28 +++++++------- 4 files changed, 38 insertions(+), 38 deletions(-) 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..94e32cd52 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)])) diff --git a/drracket-core-lib/drracket/private/syncheck-debug.rkt b/drracket-core-lib/drracket/private/syncheck-debug.rkt index d9b561fb3..09df19e3a 100644 --- a/drracket-core-lib/drracket/private/syncheck-debug.rkt +++ b/drracket-core-lib/drracket/private/syncheck-debug.rkt @@ -131,9 +131,9 @@ (hash-set! ht res stx) res)] [(vector? obj) - (let ([res (list->vector (map loop (vector->list obj)))]) - (hash-set! ht res stx) - res)] + (define res (list->vector (map loop (vector->list obj)))) + (hash-set! ht res stx) + res] [else (define res (syntax->datum stx)) (hash-set! ht res stx) diff --git a/drracket-test/tests/drracket/private/drracket-test-util.rkt b/drracket-test/tests/drracket/private/drracket-test-util.rkt index 5fbc81640..00fbc44c2 100644 --- a/drracket-test/tests/drracket/private/drracket-test-util.rkt +++ b/drracket-test/tests/drracket/private/drracket-test-util.rkt @@ -476,25 +476,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 diff --git a/drracket-test/tests/drracket/private/repl-test.rkt b/drracket-test/tests/drracket/private/repl-test.rkt index b32ea059e..02219d89d 100644 --- a/drracket-test/tests/drracket/private/repl-test.rkt +++ b/drracket-test/tests/drracket/private/repl-test.rkt @@ -1130,20 +1130,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) From 9ea41519aa617c0744277dc7b7020dea8cbdc3ec Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 02/10] Fix 6 occurrences of `let-to-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- drracket-core-lib/drracket/private/eval.rkt | 31 ++- .../drracket/private/drracket-test-util.rkt | 206 +++++++++--------- .../tests/drracket/private/easter-egg-lib.rkt | 7 +- .../private/module-lang-test-utils.rkt | 49 ++--- .../tests/drracket/private/repl-test.rkt | 30 +-- 5 files changed, 157 insertions(+), 166 deletions(-) diff --git a/drracket-core-lib/drracket/private/eval.rkt b/drracket-core-lib/drracket/private/eval.rkt index 65352f361..155344ff0 100644 --- a/drracket-core-lib/drracket/private/eval.rkt +++ b/drracket-core-lib/drracket/private/eval.rkt @@ -200,20 +200,17 @@ ;; constructs an input port for the load handler. Also ;; returns a value representing the source of code read from the file. (define (build-input-port filename) - (let* ([p (open-input-file filename)] - [chars (list (read-char p) - (read-char p) - (read-char p) - (read-char p))]) - (close-input-port p) - (cond - [(equal? chars (string->list "WXME")) - (define text (make-object text%)) - (send text load-file filename) - (define port (open-input-text-editor text)) - (port-count-lines! port) - (values port text)] - [else - (define port (open-input-file filename)) - (port-count-lines! port) - (values port filename)])))) + (define p (open-input-file filename)) + (define chars (list (read-char p) (read-char p) (read-char p) (read-char p))) + (close-input-port p) + (cond + [(equal? chars (string->list "WXME")) + (define text (make-object text%)) + (send text load-file filename) + (define port (open-input-text-editor text)) + (port-count-lines! port) + (values port text)] + [else + (define port (open-input-file filename)) + (port-count-lines! port) + (values port filename)]))) diff --git a/drracket-test/tests/drracket/private/drracket-test-util.rkt b/drracket-test/tests/drracket/private/drracket-test-util.rkt index 00fbc44c2..085a68e89 100644 --- a/drracket-test/tests/drracket/private/drracket-test-util.rkt +++ b/drracket-test/tests/drracket/private/drracket-test-util.rkt @@ -326,84 +326,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!) @@ -604,32 +604,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..af163149e 100644 --- a/drracket-test/tests/drracket/private/easter-egg-lib.rkt +++ b/drracket-test/tests/drracket/private/easter-egg-lib.rkt @@ -113,10 +113,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..fe1efcada 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 diff --git a/drracket-test/tests/drracket/private/repl-test.rkt b/drracket-test/tests/drracket/private/repl-test.rkt index 02219d89d..c45c653cf 100644 --- a/drracket-test/tests/drracket/private/repl-test.rkt +++ b/drracket-test/tests/drracket/private/repl-test.rkt @@ -1192,21 +1192,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)) From e1768e3adc7bb65d3a8c440cb91f4f738386c3f0 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 03/10] Fix 2 occurrences of `cond-else-cond-to-cond` The `else` clause of this `cond` expression is another `cond` expression and can be flattened. --- .../drracket/private/drracket-test-util.rkt | 81 +++++++++---------- .../private/module-lang-test-utils.rkt | 11 +-- 2 files changed, 41 insertions(+), 51 deletions(-) diff --git a/drracket-test/tests/drracket/private/drracket-test-util.rkt b/drracket-test/tests/drracket/private/drracket-test-util.rkt index 085a68e89..80f21572b 100644 --- a/drracket-test/tests/drracket/private/drracket-test-util.rkt +++ b/drracket-test/tests/drracket/private/drracket-test-util.rkt @@ -524,52 +524,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)))])) 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 fe1efcada..df8e94925 100644 --- a/drracket-test/tests/drracket/private/module-lang-test-utils.rkt +++ b/drracket-test/tests/drracket/private/module-lang-test-utils.rkt @@ -152,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) From 98deae535ce997213d5b687014b48c7979c0022e Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 04/10] Fix 1 occurrence of `when-expression-in-for-loop-to-when-keyword` Use the `#:when` keyword instead of `when` to reduce loop body indentation. --- .../private/module-lang-test-utils.rkt | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) 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 df8e94925..bba395eb6 100644 --- a/drracket-test/tests/drracket/private/module-lang-test-utils.rkt +++ b/drracket-test/tests/drracket/private/module-lang-test-utils.rkt @@ -173,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) From b67086dc66d294f8f66eae69cb490e9e0ff47bdb Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 05/10] Fix 1 occurrence of `if-else-false-to-and` This `if` expression can be refactored to an equivalent expression using `and`. --- drracket-test/tests/drracket/private/easter-egg-lib.rkt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drracket-test/tests/drracket/private/easter-egg-lib.rkt b/drracket-test/tests/drracket/private/easter-egg-lib.rkt index af163149e..aff4966d3 100644 --- a/drracket-test/tests/drracket/private/easter-egg-lib.rkt +++ b/drracket-test/tests/drracket/private/easter-egg-lib.rkt @@ -81,10 +81,7 @@ 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 From 7176a5a6305b8da1662e52b1b327b1313ede0395 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 06/10] Fix 1 occurrence of `printf-to-display` This use of `printf` has no arguments other than the template string. --- drracket-test/tests/drracket/private/easter-egg-lib.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drracket-test/tests/drracket/private/easter-egg-lib.rkt b/drracket-test/tests/drracket/private/easter-egg-lib.rkt index aff4966d3..2096d71fc 100644 --- a/drracket-test/tests/drracket/private/easter-egg-lib.rkt +++ b/drracket-test/tests/drracket/private/easter-egg-lib.rkt @@ -86,7 +86,7 @@ and then loading the framework after that. (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)) From 734aa13a80b7ec96cc47a85c9093fbc6a11c5141 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 07/10] Fix 2 occurrences of `define-lambda-to-define` The `define` form supports a shorthand for defining functions. --- drracket-core-lib/drracket/private/language-configuration.rkt | 3 ++- drracket-test/tests/drracket/private/drracket-test-util.rkt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drracket-core-lib/drracket/private/language-configuration.rkt b/drracket-core-lib/drracket/private/language-configuration.rkt index 4a2fbfe07..e0bcb6c7e 100644 --- a/drracket-core-lib/drracket/private/language-configuration.rkt +++ b/drracket-core-lib/drracket/private/language-configuration.rkt @@ -707,7 +707,8 @@ (define get/set-selected-language-settings #f) ;; selected-get-keystrokes : -> (listof (list char (-> any))) - (define selected-get-keystrokes (λ () '())) + (define (selected-get-keystrokes) + '()) (define details-computed? #f) diff --git a/drracket-test/tests/drracket/private/drracket-test-util.rkt b/drracket-test/tests/drracket/private/drracket-test-util.rkt index 80f21572b..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) From f77605f2a365d151e15e7db4d901a715777c7a51 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 08/10] Fix 1 occurrence of `explicit-cond-else-void` Add an explicit `[else (void)]` clause to make the default behavior clear. --- drracket-test/tests/drracket/private/repl-test.rkt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drracket-test/tests/drracket/private/repl-test.rkt b/drracket-test/tests/drracket/private/repl-test.rkt index c45c653cf..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) From 2360349eff7e4e1b16f084cd1a01c6fc793a4716 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 09/10] Fix 1 occurrence of `nested-and-to-flat-and` Nested `and` expressions can be flattened into a single, equivalent `and` expression. --- drracket-test/tests/drracket/private/easter-egg-lib.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drracket-test/tests/drracket/private/easter-egg-lib.rkt b/drracket-test/tests/drracket/private/easter-egg-lib.rkt index 2096d71fc..e0699e9f2 100644 --- a/drracket-test/tests/drracket/private/easter-egg-lib.rkt +++ b/drracket-test/tests/drracket/private/easter-egg-lib.rkt @@ -81,7 +81,7 @@ 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)) - (and (and active (drracket-frame? active)) active)) + (and active (drracket-frame? active) active)) (define drr-fr (or (wait-for-drracket-frame-pred) (begin From c277e1db59f2e529a41b1c67a9560cf717c57967 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:25:45 +0000 Subject: [PATCH 10/10] Fix 1 occurrence of `for-each-to-for` This `for-each` operation can be replaced with a `for` loop. --- .../tests/drracket/private/repl-test.rkt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drracket-test/tests/drracket/private/repl-test.rkt b/drracket-test/tests/drracket/private/repl-test.rkt index e886a6608..b4d7d7c0f 100644 --- a/drracket-test/tests/drracket/private/repl-test.rkt +++ b/drracket-test/tests/drracket/private/repl-test.rkt @@ -1088,16 +1088,15 @@ This produces an ACK message [(string? program) (insert-in-definitions/newlines drr-frame program)] [(eq? program 'fraction-sum) (setup-fraction-sum-interactions)] [(list? program) - (for-each (lambda (item) - (cond - [(string? item) (insert-in-definitions/newlines drr-frame item)] - [(eq? item 'left) - (queue-callback/res (λ () - (send defs-text set-position - (- (send defs-text get-start-position) 1) - (- (send defs-text get-start-position) 1))))] - [(pair? item) (apply test:menu-select item)])) - program)] + (for ([item (in-list program)]) + (cond + [(string? item) (insert-in-definitions/newlines drr-frame item)] + [(eq? item 'left) + (queue-callback/res (λ () + (send defs-text set-position + (- (send defs-text get-start-position) 1) + (- (send defs-text get-start-position) 1))))] + [(pair? item) (apply test:menu-select item)]))] [else (void)]) (do-execute drr-frame #f)