From 4d7c9a3741781851237fddb2d4d9cab63e03a86e Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 01/11] Fix 1 occurrence of `make-temporary-directory-migration` Use `make-temporary-directory` to make directories instead of `make-temporary-file`. --- drracket-test/tests/drracket/example-tool.rkt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drracket-test/tests/drracket/example-tool.rkt b/drracket-test/tests/drracket/example-tool.rkt index a2ba53506..316c2874b 100644 --- a/drracket-test/tests/drracket/example-tool.rkt +++ b/drracket-test/tests/drracket/example-tool.rkt @@ -8,8 +8,7 @@ (define new-collection-root #; (string->path "C:\\tmp") - (make-temporary-file "drracket-test-example-tool~a" - 'directory)) + (make-temporary-directory "drracket-test-example-tool~a")) (define coll (build-path new-collection-root "coll")) (unless (directory-exists? coll) (make-directory coll)) From 5e1f4b707f7e5ecd4b800a56833d7d6f2af2f5a1 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 02/11] Fix 1 occurrence of `nested-when-to-compound-when` Nested `when` expressions can be merged into a single compound `when` expression. --- .../tests/drracket/no-write-and-frame-leak.rkt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drracket-test/tests/drracket/no-write-and-frame-leak.rkt b/drracket-test/tests/drracket/no-write-and-frame-leak.rkt index 167235d81..192e23b60 100644 --- a/drracket-test/tests/drracket/no-write-and-frame-leak.rkt +++ b/drracket-test/tests/drracket/no-write-and-frame-leak.rkt @@ -139,13 +139,11 @@ This test checks: (process-container item))))) (define (record-shortcut item) - (when (is-a? item selectable-menu-item<%>) - (when (send item get-shortcut) - (define k (append (sort (send item get-shortcut-prefix) - string<=? - #:key symbol->string) - (list (send item get-shortcut)))) - (hash-update! shortcuts k (λ (v) (cons (send item get-label) v)) '())))) + (when (and (is-a? item selectable-menu-item<%>) (send item get-shortcut)) + (define k + (append (sort (send item get-shortcut-prefix) string<=? #:key symbol->string) + (list (send item get-shortcut)))) + (hash-update! shortcuts k (λ (v) (cons (send item get-label) v)) '()))) (define (get-lab item) (cond From b62a4cc0a46007603ae2a4f17f259c2c050201c8 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 03/11] Fix 2 occurrences of `quasiquote-to-list` This quasiquotation is equialent to a simple `list` call. --- drracket-core-lib/drracket/private/debug.rkt | 2 +- .../drracket/find-module-path-completions.rkt | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drracket-core-lib/drracket/private/debug.rkt b/drracket-core-lib/drracket/private/debug.rkt index 6fbb2846d..34b27fee5 100644 --- a/drracket-core-lib/drracket/private/debug.rkt +++ b/drracket-core-lib/drracket/private/debug.rkt @@ -483,7 +483,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-tool-text-lib/drracket/find-module-path-completions.rkt b/drracket-tool-text-lib/drracket/find-module-path-completions.rkt index c715ac956..2c4741a0d 100644 --- a/drracket-tool-text-lib/drracket/find-module-path-completions.rkt +++ b/drracket-tool-text-lib/drracket/find-module-path-completions.rkt @@ -183,20 +183,20 @@ (and (regexp? (list-ref link-ent 2)) (regexp-match (list-ref link-ent 2) (version))) #t)) - `(,(list-ref link-ent 0) - ,(simplify-path - (let* ([encoded-path (list-ref link-ent 1)] - [path (cond - [(string? encoded-path) encoded-path] - [(bytes? encoded-path) (bytes->path encoded-path)] - [else (apply build-path - (for/list ([elem (in-list encoded-path)]) - (if (bytes? elem) - (bytes->path-element elem) - elem)))])]) - (if (relative-path? path) - (build-path base path) - path)))))] + (list (list-ref link-ent 0) + (simplify-path (let* ([encoded-path (list-ref link-ent 1)] + [path (cond + [(string? encoded-path) encoded-path] + [(bytes? encoded-path) (bytes->path encoded-path)] + [else + (apply build-path + (for/list ([elem (in-list encoded-path)]) + (if (bytes? elem) + (bytes->path-element elem) + elem)))])]) + (if (relative-path? path) + (build-path base path) + path)))))] [else '()])] [else (for/list ([clp (in-list library-collection-paths)]) From 0a972740234d1d035f6385b2174c024b89a8cd7c Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 04/11] Fix 1 occurrence of `inline-unnecessary-begin` This `begin` form can be flattened into the surrounding definition context. --- drracket-test/tests/drracket/syncheck-test.rkt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drracket-test/tests/drracket/syncheck-test.rkt b/drracket-test/tests/drracket/syncheck-test.rkt index 884a25a79..1469a1cdc 100644 --- a/drracket-test/tests/drracket/syncheck-test.rkt +++ b/drracket-test/tests/drracket/syncheck-test.rkt @@ -1772,12 +1772,11 @@ (λ () (define drs (wait-for-drracket-frame)) ;(set-language-level! (list "Pretty Big")) - (begin - (set-language-level! (list "Pretty Big") #f) - (test:set-radio-box-item! "No debugging or profiling") - (let ([f (test:get-active-top-level-window)]) - (test:button-push "OK") - (wait-for-new-frame f))) + (set-language-level! (list "Pretty Big") #f) + (test:set-radio-box-item! "No debugging or profiling") + (let ([f (test:get-active-top-level-window)]) + (test:button-push "OK") + (wait-for-new-frame f)) (do-execute drs) (define defs (queue-callback/res (λ () (send drs get-definitions-text)))) (define filename (make-temporary-file "syncheck-test~a" #f temp-dir)) From 2ab4a076fa507c1e47ca57f25f12426b8845e4dd Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 05/11] Fix 7 occurrences of `let-to-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- .../tests/drracket/syncheck-test.rkt | 347 +++++++++--------- .../tests/drracket/test-engine-test.rkt | 148 ++++---- 2 files changed, 252 insertions(+), 243 deletions(-) diff --git a/drracket-test/tests/drracket/syncheck-test.rkt b/drracket-test/tests/drracket/syncheck-test.rkt index 1469a1cdc..5078590d3 100644 --- a/drracket-test/tests/drracket/syncheck-test.rkt +++ b/drracket-test/tests/drracket/syncheck-test.rkt @@ -1808,177 +1808,163 @@ (define ((run-one-test save-dir) test) (set! total-tests-run (+ total-tests-run 1)) - (let* ([drs (wait-for-drracket-frame)] - [defs (queue-callback/res (λ () (send drs get-definitions-text)))]) - (clear-definitions drs) - (cond - [(test? test) - (let ([pre-input (test-input test)] - [expected (test-expected test)] - [arrows (test-arrows test)] - [tooltips (test-tooltips test)] - [relative "list.rkt"] - [setup (test-setup test)] - [teardown (test-teardown test)] - [extra-files (test-extra-files test)] - [extra-info? (test-extra-info? test)]) - (define extra-file-paths - (for/list ([(name contents) (in-hash extra-files)]) - (define path (build-path save-dir name)) - (display-to-file contents path #:mode 'text) - path)) - - (define setup-result (setup)) - (define input (if (procedure? pre-input) - (pre-input setup-result) - pre-input)) - (cond - [(dir-test? test) - (insert-in-definitions drs (format input (path->require-string relative)))] - [else (insert-in-definitions drs input)]) - (click-check-syntax-and-check-errors drs test extra-info?) - - ;; need to check for syntax error here - (let ([got (get-annotated-output drs)] - [got-arrows (queue-callback/res (λ () (send defs syncheck:get-bindings-table)))]) - (when extra-info? - (printf "got-arrows\n") - (pretty-print got-arrows) - (newline) - - (printf "'drracket:syncheck:show-arrows? ~s\n" - (preferences:get 'drracket:syncheck:show-arrows?))) - (compare-output (cond - [(dir-test? test) - (map (lambda (x) - (list (if (eq? (car x) 'relative-path) - (path->require-string relative) - (car x)) - (cadr x))) - expected)] - [else - expected]) - got - arrows - got-arrows - input + (define drs (wait-for-drracket-frame)) + (define defs (queue-callback/res (λ () (send drs get-definitions-text)))) + (clear-definitions drs) + (cond + [(test? test) + (let ([pre-input (test-input test)] + [expected (test-expected test)] + [arrows (test-arrows test)] + [tooltips (test-tooltips test)] + [relative "list.rkt"] + [setup (test-setup test)] + [teardown (test-teardown test)] + [extra-files (test-extra-files test)] + [extra-info? (test-extra-info? test)]) + (define extra-file-paths + (for/list ([(name contents) (in-hash extra-files)]) + (define path (build-path save-dir name)) + (display-to-file contents path #:mode 'text) + path)) + + (define setup-result (setup)) + (define input + (if (procedure? pre-input) + (pre-input setup-result) + pre-input)) + (cond + [(dir-test? test) + (insert-in-definitions drs (format input (path->require-string relative)))] + [else (insert-in-definitions drs input)]) + (click-check-syntax-and-check-errors drs test extra-info?) + + ;; need to check for syntax error here + (let ([got (get-annotated-output drs)] + [got-arrows (queue-callback/res (λ () (send defs syncheck:get-bindings-table)))]) + (when extra-info? + (printf "got-arrows\n") + (pretty-print got-arrows) + (newline) + + (printf "'drracket:syncheck:show-arrows? ~s\n" + (preferences:get 'drracket:syncheck:show-arrows?))) + (compare-output (cond + [(dir-test? test) + (map (lambda (x) + (list (if (eq? (car x) 'relative-path) + (path->require-string relative) + (car x)) + (cadr x))) + expected)] + [else expected]) + got + arrows + got-arrows + input + (test-line test))) + (when tooltips + (compare-tooltips (queue-callback/res (λ () (send defs syncheck:get-bindings-table #t))) + tooltips (test-line test))) - (when tooltips - (compare-tooltips (queue-callback/res (λ () (send defs syncheck:get-bindings-table #t))) - tooltips - (test-line test))) - - (teardown setup-result) - (for-each delete-directory/files extra-file-paths))] - [(rename-test? test) - (insert-in-definitions drs (rename-test-input test)) - (click-check-syntax-and-check-errors drs test #f) - (define menu-item - (queue-callback/res - (λ () - (define defs (send drs get-definitions-text)) - (define menu (make-object popup-menu%)) - (send defs syncheck:build-popup-menu menu (rename-test-pos test) defs) - (define item-name (format "Rename ~a" (rename-test-old-name test))) - (define menu-item - (for/or ([x (in-list (send menu get-items))]) - (and (is-a? x labelled-menu-item<%>) - (equal? (send x get-label) item-name) - x))) - (cond - [menu-item - menu-item] - [else - (eprintf "syncheck-test.rkt: rename test ~s didn't find menu item named ~s in ~s\n" - test - item-name - (map (λ (x) (and (is-a? x labelled-menu-item<%>) (send x get-label))) - (send menu get-items))) - #f])))) - (when (and menu-item (rename-test-new-name test) (rename-test-output test)) - (queue-callback (λ () (send menu-item command (make-object control-event% 'menu)))) - (wait-for-new-frame drs) - (for ([x (in-string (rename-test-new-name test))]) - (test:keystroke x)) - (test:button-push "OK") - (define result - (queue-callback/res (λ () - (define defs (send drs get-definitions-text)) - (send defs get-text 0 (send defs last-position))))) - (unless (equal? result (rename-test-output test)) - (eprintf "syncheck-test.rkt FAILED\n test ~s\n got ~s\n" - test - result)))] - [(prefix-test? test) - (insert-in-definitions drs (prefix-test-input test)) - (click-check-syntax-and-check-errors drs test #f) - (define menu-item - (queue-callback/res - (λ () - (define defs (send drs get-definitions-text)) - (define menu (make-object popup-menu%)) - (send defs syncheck:build-popup-menu menu (prefix-test-pos test) defs) - (define item-name "Add Require Prefix") - (define menu-item - (for/or ([x (in-list (send menu get-items))]) - (and (is-a? x labelled-menu-item<%>) - (equal? (send x get-label) item-name) - x))) - (cond - [menu-item - menu-item] - [else - (eprintf "syncheck-test.rkt: prefix test ~s didn't find menu item named ~s in ~s\n" - test - item-name - (map (λ (x) (and (is-a? x labelled-menu-item<%>) (send x get-label))) - (send menu get-items))) - #f])))) - (when menu-item - (queue-callback (λ () (send menu-item command (make-object control-event% 'menu)))) - (wait-for-new-frame drs) - (for ([x (in-string (prefix-test-prefix test))]) - (test:keystroke x)) - (test:button-push "OK") - (define result - (queue-callback/res (λ () - (define defs (send drs get-definitions-text)) - (send defs get-text 0 (send defs last-position))))) - (unless (equal? result (prefix-test-output test)) - (eprintf "syncheck-test.rkt FAILED\n test ~s\n got ~s\n" - test - result)))] - [(err-test? test) - (let/ec done - (insert-in-definitions drs (err-test-input test)) - (define err (click-check-syntax-and-check-errors drs test #f #:err-ok? #t)) - (unless err - (eprintf "syncheck-test.rkt FAILED\n test ~s\n didn't get an error\n" - test) - (done)) - (define expected (err-test-expected test)) - (define message-good? - (cond - [(string? expected) - (equal? expected err)] - [else - (regexp-match? expected err)])) - (unless message-good? - (eprintf "syncheck-test.rkt FAILED error doesn't match\n test ~s\n ~s\n" - test - err) - (done)) - (define srclocs (queue-callback/res (λ () (send (send drs get-interactions-text) get-error-ranges)))) - (define actual - (for/set ([srcloc (in-list srclocs)]) - (list (srcloc-position srcloc) - (srcloc-span srcloc)))) - (unless (equal? actual (err-test-locations test)) - (eprintf "syncheck-test.rkt FAILED srclocs don't match\n test ~s\n actual ~s\n got ~s\n" - test - actual - (err-test-locations test))) - (void))]))) + + (teardown setup-result) + (for-each delete-directory/files extra-file-paths))] + [(rename-test? test) + (insert-in-definitions drs (rename-test-input test)) + (click-check-syntax-and-check-errors drs test #f) + (define menu-item + (queue-callback/res + (λ () + (define defs (send drs get-definitions-text)) + (define menu (make-object popup-menu%)) + (send defs syncheck:build-popup-menu menu (rename-test-pos test) defs) + (define item-name (format "Rename ~a" (rename-test-old-name test))) + (define menu-item + (for/or ([x (in-list (send menu get-items))]) + (and (is-a? x labelled-menu-item<%>) (equal? (send x get-label) item-name) x))) + (cond + [menu-item menu-item] + [else + (eprintf "syncheck-test.rkt: rename test ~s didn't find menu item named ~s in ~s\n" + test + item-name + (map (λ (x) (and (is-a? x labelled-menu-item<%>) (send x get-label))) + (send menu get-items))) + #f])))) + (when (and menu-item (rename-test-new-name test) (rename-test-output test)) + (queue-callback (λ () (send menu-item command (make-object control-event% 'menu)))) + (wait-for-new-frame drs) + (for ([x (in-string (rename-test-new-name test))]) + (test:keystroke x)) + (test:button-push "OK") + (define result + (queue-callback/res (λ () + (define defs (send drs get-definitions-text)) + (send defs get-text 0 (send defs last-position))))) + (unless (equal? result (rename-test-output test)) + (eprintf "syncheck-test.rkt FAILED\n test ~s\n got ~s\n" test result)))] + [(prefix-test? test) + (insert-in-definitions drs (prefix-test-input test)) + (click-check-syntax-and-check-errors drs test #f) + (define menu-item + (queue-callback/res + (λ () + (define defs (send drs get-definitions-text)) + (define menu (make-object popup-menu%)) + (send defs syncheck:build-popup-menu menu (prefix-test-pos test) defs) + (define item-name "Add Require Prefix") + (define menu-item + (for/or ([x (in-list (send menu get-items))]) + (and (is-a? x labelled-menu-item<%>) (equal? (send x get-label) item-name) x))) + (cond + [menu-item menu-item] + [else + (eprintf "syncheck-test.rkt: prefix test ~s didn't find menu item named ~s in ~s\n" + test + item-name + (map (λ (x) (and (is-a? x labelled-menu-item<%>) (send x get-label))) + (send menu get-items))) + #f])))) + (when menu-item + (queue-callback (λ () (send menu-item command (make-object control-event% 'menu)))) + (wait-for-new-frame drs) + (for ([x (in-string (prefix-test-prefix test))]) + (test:keystroke x)) + (test:button-push "OK") + (define result + (queue-callback/res (λ () + (define defs (send drs get-definitions-text)) + (send defs get-text 0 (send defs last-position))))) + (unless (equal? result (prefix-test-output test)) + (eprintf "syncheck-test.rkt FAILED\n test ~s\n got ~s\n" test result)))] + [(err-test? test) + (let/ec done + (insert-in-definitions drs (err-test-input test)) + (define err (click-check-syntax-and-check-errors drs test #f #:err-ok? #t)) + (unless err + (eprintf "syncheck-test.rkt FAILED\n test ~s\n didn't get an error\n" test) + (done)) + (define expected (err-test-expected test)) + (define message-good? + (cond + [(string? expected) (equal? expected err)] + [else (regexp-match? expected err)])) + (unless message-good? + (eprintf "syncheck-test.rkt FAILED error doesn't match\n test ~s\n ~s\n" test err) + (done)) + (define srclocs + (queue-callback/res (λ () (send (send drs get-interactions-text) get-error-ranges)))) + (define actual + (for/set ([srcloc (in-list srclocs)]) + (list (srcloc-position srcloc) (srcloc-span srcloc)))) + (unless (equal? actual (err-test-locations test)) + (eprintf + "syncheck-test.rkt FAILED srclocs don't match\n test ~s\n actual ~s\n got ~s\n" + test + actual + (err-test-locations test))) + (void))])) (define (path->require-string relative) (define (p->string p) @@ -2068,15 +2054,18 @@ (for-each (test-binding #f actual-ht) (hash-map expected-ht cons)))) (define (compare-output raw-expected got arrows arrows-got input line) - (let ([expected (collapse-and-rename raw-expected)]) - (cond - [(not-matching-colors got expected) - => - (λ (msg) - (eprintf "FAILED line ~a: ~s\n expected: ~s\n got: ~s\n ~a\n" - line input expected got msg))] - [else - (compare-arrows input arrows arrows-got line)]))) + (define expected (collapse-and-rename raw-expected)) + (cond + [(not-matching-colors got expected) + => + (λ (msg) + (eprintf "FAILED line ~a: ~s\n expected: ~s\n got: ~s\n ~a\n" + line + input + expected + got + msg))] + [else (compare-arrows input arrows arrows-got line)])) (define (not-matching-colors got expected) (let loop ([got got] diff --git a/drracket-test/tests/drracket/test-engine-test.rkt b/drracket-test/tests/drracket/test-engine-test.rkt index 79753ef97..f3d55e4ff 100644 --- a/drracket-test/tests/drracket/test-engine-test.rkt +++ b/drracket-test/tests/drracket/test-engine-test.rkt @@ -243,11 +243,11 @@ (common-signatures-sdp))) (define (prepare-for-test-expression) - (let ([drs (wait-for-drracket-frame)]) - (clear-definitions drs) - (set-language #t) - (sleep 1) ;; this shouldn't be neccessary.... - (do-execute drs))) + (define drs (wait-for-drracket-frame)) + (clear-definitions drs) + (set-language #t) + (sleep 1) ;; this shouldn't be neccessary.... + (do-execute drs)) ;; test-setting : (-> void) string string string -> void ;; opens the language dialog, runs `set-setting' @@ -262,15 +262,19 @@ (let ([f (test:get-active-top-level-window)]) (fw:test:button-push "OK") (wait-for-new-frame f)) - (let* ([drs (test:get-active-top-level-window)] - [interactions (send drs get-interactions-text)]) - (clear-definitions drs) - (insert-in-definitions drs expression) - (do-execute drs) - (let ([got (fetch-output/should-be-tested drs)]) - (unless (string=? result got) - (eprintf "FAILED: ~s ~s ~s test\n expected: ~s\n got: ~s\n" - (language) setting-name expression result got))))) + (define drs (test:get-active-top-level-window)) + (send drs get-interactions-text) + (clear-definitions drs) + (insert-in-definitions drs expression) + (do-execute drs) + (define got (fetch-output/should-be-tested drs)) + (unless (string=? result got) + (eprintf "FAILED: ~s ~s ~s test\n expected: ~s\n got: ~s\n" + (language) + setting-name + expression + result + got))) (define (fetch-output/should-be-tested . args) (regexp-replace (regexp @@ -297,11 +301,11 @@ ((regexp-match #rx"^Ran ([NoOneTwo0-9]+) tests?.\n([NoOneTwo0-9]+) tests? passed.\n(([NoOneTwo0-9]+) signature violations?.)?" txt) => (lambda (match) - (let-values (((_ test-count-text test-passed-count-text __ signature-violations-count-text) - (apply values match))) - (values (parse-number test-count-text) - (parse-number test-passed-count-text) - (parse-number signature-violations-count-text))))) + (define-values (_ test-count-text test-passed-count-text __ signature-violations-count-text) + (apply values match)) + (values (parse-number test-count-text) + (parse-number test-passed-count-text) + (parse-number signature-violations-count-text)))) ((regexp-match #rx"^This program must be tested!\n(([NoOneTwo0-9]+) signature violations?.)?" txt) => (lambda (match) (values 0 0 (parse-number (caddr match))))) @@ -309,23 +313,25 @@ (error 'parse-test-failure-header "bad test failure header" txt)))) (define (parse-test-failures txt) - (let-values (((test-count test-passed-count signature-violations-count) - (parse-test-failure-header txt))) - (let ((check-failures - (cond - ((regexp-match #rx"Check failures:\n(.*)" txt) - => (lambda (res) - (parse-check-failures (cadr res)))) - (else '()))) - (signature-violations - (cond - ((regexp-match #rx"Signature violations:\n(.*)" txt) - => (lambda (res) - (parse-signature-violations (cadr res)))) - (else '())))) - (values test-count test-passed-count signature-violations-count - check-failures - signature-violations)))) + (define-values (test-count test-passed-count signature-violations-count) + (parse-test-failure-header txt)) + (define check-failures + (cond + [(regexp-match #rx"Check failures:\n(.*)" txt) + => + (lambda (res) (parse-check-failures (cadr res)))] + [else '()])) + (define signature-violations + (cond + [(regexp-match #rx"Signature violations:\n(.*)" txt) + => + (lambda (res) (parse-signature-violations (cadr res)))] + [else '()])) + (values test-count + test-passed-count + signature-violations-count + check-failures + signature-violations)) (define-struct check-expect-failure (actual expected line column) @@ -431,34 +437,48 @@ (expected got)]))] [check-failures (lambda (where signature-violations-expected check-failures-expected) - (let ((text - (cond - ((send (send definitions-text get-tab) get-test-editor) - => (lambda (test-editor) - (let ((text (send test-editor get-text 0 'eof #t))) - (if (string=? text "") - #f - text)))) - (else #f)))) - - (cond - ((and (null? signature-violations-expected) - (null? check-failures-expected)) - (when text - (eprintf "FAILED: ~s ~s expected ~s to produce no check failures or signature violations:\ngot:\n~a\ninstead\n" - where (language) expression text))) - (text - (let-values (((test-count test-passed-count signature-violation-count check-failures signature-violations) - (parse-test-failures text))) - (when (not (equal? check-failures check-failures-expected)) - (eprintf "FAILED: ~s ~s expected ~s to produce check failures:\n~s\ngot:\n~s\ninstead\n" - where (language) expression check-failures-expected check-failures)) - (when (not (equal? signature-violations signature-violations-expected)) - (eprintf "FAILED: ~s ~s expected ~s to produce signature violations:\n~s\ngot:\n~s\ninstead\n" - where (language) expression signature-violations-expected signature-violations)))) - (else - (eprintf "expected ~a check failures and ~a signature violations but got none" - (length check-failures-expected) (length signature-violations-expected))))))] + (define text + (cond + [(send (send definitions-text get-tab) get-test-editor) + => + (lambda (test-editor) + (let ([text (send test-editor get-text 0 'eof #t)]) (if (string=? text "") #f text)))] + [else #f])) + + (cond + [(and (null? signature-violations-expected) (null? check-failures-expected)) + (when text + (eprintf + "FAILED: ~s ~s expected ~s to produce no check failures or signature violations:\ngot:\n~a\ninstead\n" + where + (language) + expression + text))] + [text + (let-values ([(test-count test-passed-count + signature-violation-count + check-failures + signature-violations) + (parse-test-failures text)]) + (when (not (equal? check-failures check-failures-expected)) + (eprintf "FAILED: ~s ~s expected ~s to produce check failures:\n~s\ngot:\n~s\ninstead\n" + where + (language) + expression + check-failures-expected + check-failures)) + (when (not (equal? signature-violations signature-violations-expected)) + (eprintf + "FAILED: ~s ~s expected ~s to produce signature violations:\n~s\ngot:\n~s\ninstead\n" + where + (language) + expression + signature-violations-expected + signature-violations)))] + [else + (eprintf "expected ~a check failures and ~a signature violations but got none" + (length check-failures-expected) + (length signature-violations-expected))]))] [make-err-msg (lambda (expected) From 18d3b590a316bf99db70fc03d924ca2341de9988 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 06/11] Fix 1 occurrence of `map-to-for` This `map` operation can be replaced with a `for/list` loop. --- drracket-test/tests/drracket/syncheck-test.rkt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drracket-test/tests/drracket/syncheck-test.rkt b/drracket-test/tests/drracket/syncheck-test.rkt index 5078590d3..aa404b125 100644 --- a/drracket-test/tests/drracket/syncheck-test.rkt +++ b/drracket-test/tests/drracket/syncheck-test.rkt @@ -1983,14 +1983,13 @@ (define (collapse-and-rename expected) (define renamed - (map (lambda (ent) - (let* ([str (car ent)] - [id (cadr ent)] - [matches (assoc id remappings)]) - (if matches - (list str (cadr matches)) - ent))) - expected)) + (for/list ([ent (in-list expected)]) + (define str (car ent)) + (define id (cadr ent)) + (define matches (assoc id remappings)) + (if matches + (list str (cadr matches)) + ent))) (let loop ([ids renamed]) (cond [(null? ids) null] From e87e4f9aecda83b986ec6cba3c63d552fab12845 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 07/11] Fix 1 occurrence of `cond-let-to-cond-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- drracket-test/tests/drracket/syncheck-test.rkt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drracket-test/tests/drracket/syncheck-test.rkt b/drracket-test/tests/drracket/syncheck-test.rkt index aa404b125..a44df1303 100644 --- a/drracket-test/tests/drracket/syncheck-test.rkt +++ b/drracket-test/tests/drracket/syncheck-test.rkt @@ -1995,11 +1995,11 @@ [(null? ids) null] [(null? (cdr ids)) ids] [else - (let ([fst (car ids)] - [snd (cadr ids)]) - (if (eq? (cadr fst) (cadr snd)) - (loop (cons (list (string-append (car fst) (car snd)) (cadr fst)) (cddr ids))) - (cons fst (loop (cdr ids)))))]))) + (define fst (car ids)) + (define snd (cadr ids)) + (if (eq? (cadr fst) (cadr snd)) + (loop (cons (list (string-append (car fst) (car snd)) (cadr fst)) (cddr ids))) + (cons fst (loop (cdr ids))))]))) ;; compare-arrows : expression ;; (or/c #f (listof (cons (list number-or-proc number-or-proc) From c27c4ab8e1d63bb453ff3c59dae5038812600ff4 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 08/11] Fix 1 occurrence of `error-to-raise-arguments-error` Use `raise-arguments-error` instead of `error` for better error messages that follow Racket conventions. --- drracket-test/tests/drracket/language-test.rkt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drracket-test/tests/drracket/language-test.rkt b/drracket-test/tests/drracket/language-test.rkt index 4c2942a09..0f0fa4d50 100644 --- a/drracket-test/tests/drracket/language-test.rkt +++ b/drracket-test/tests/drracket/language-test.rkt @@ -1812,8 +1812,7 @@ the settings above should match r5rs (loop child))] [(is-a? gui-thing radio-box%) (k gui-thing)])))])) - (error 'find-output-radio-box "could not find `~a' radio box" - label))) + (raise-arguments-error 'find-output-radio-box "could not find `' radio box" "label" label))) (define re:out-of-sync (regexp From d8ee5ffedae507872b41a2afc3bcdd123d1d0ecf Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 09/11] Fix 2 occurrences of `string-append-with-format-to-format` This `string-append` with `format` expression can be simplified to a single `format` call. --- drracket-test/tests/drracket/language-test.rkt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drracket-test/tests/drracket/language-test.rkt b/drracket-test/tests/drracket/language-test.rkt index 0f0fa4d50..f0616a808 100644 --- a/drracket-test/tests/drracket/language-test.rkt +++ b/drracket-test/tests/drracket/language-test.rkt @@ -1932,16 +1932,22 @@ the settings above should match r5rs (define (test-undefined-var id #:icon+in? [icon+in? #f]) (test-expression id - (string-append (if icon+in? "{stop-22x22.png} " "") - (format "~a: this variable is not defined" id) - (if icon+in? (format " in: ~a " id) "")))) + (format "~a~a: this variable is not defined~a" + (if icon+in? "{stop-22x22.png} " "") + id + (if icon+in? + (format " in: ~a " id) + "")))) (define (test-undefined-fn exp id #:icon+in? [icon+in? #f]) (test-expression exp - (string-append (if icon+in? "{stop-22x22.png} " "") - (format "~a: this function is not defined" id) - (if icon+in? (format " in: ~a " id) "")))) + (format "~a~a: this function is not defined~a" + (if icon+in? "{stop-22x22.png} " "") + id + (if icon+in? + (format " in: ~a " id) + "")))) (define-syntax (go stx) (syntax-case stx () From 1fed9f71b90182a781021aa80c34ff175665231a Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 10/11] Fix 1 occurrence of `cond-let-to-cond-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- .../tests/drracket/syncheck-test.rkt | 111 +++++++++--------- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/drracket-test/tests/drracket/syncheck-test.rkt b/drracket-test/tests/drracket/syncheck-test.rkt index a44df1303..00cb592e5 100644 --- a/drracket-test/tests/drracket/syncheck-test.rkt +++ b/drracket-test/tests/drracket/syncheck-test.rkt @@ -1813,63 +1813,62 @@ (clear-definitions drs) (cond [(test? test) - (let ([pre-input (test-input test)] - [expected (test-expected test)] - [arrows (test-arrows test)] - [tooltips (test-tooltips test)] - [relative "list.rkt"] - [setup (test-setup test)] - [teardown (test-teardown test)] - [extra-files (test-extra-files test)] - [extra-info? (test-extra-info? test)]) - (define extra-file-paths - (for/list ([(name contents) (in-hash extra-files)]) - (define path (build-path save-dir name)) - (display-to-file contents path #:mode 'text) - path)) - - (define setup-result (setup)) - (define input - (if (procedure? pre-input) - (pre-input setup-result) - pre-input)) - (cond - [(dir-test? test) - (insert-in-definitions drs (format input (path->require-string relative)))] - [else (insert-in-definitions drs input)]) - (click-check-syntax-and-check-errors drs test extra-info?) - - ;; need to check for syntax error here - (let ([got (get-annotated-output drs)] - [got-arrows (queue-callback/res (λ () (send defs syncheck:get-bindings-table)))]) - (when extra-info? - (printf "got-arrows\n") - (pretty-print got-arrows) - (newline) - - (printf "'drracket:syncheck:show-arrows? ~s\n" - (preferences:get 'drracket:syncheck:show-arrows?))) - (compare-output (cond - [(dir-test? test) - (map (lambda (x) - (list (if (eq? (car x) 'relative-path) - (path->require-string relative) - (car x)) - (cadr x))) - expected)] - [else expected]) - got - arrows - got-arrows - input + (define pre-input (test-input test)) + (define expected (test-expected test)) + (define arrows (test-arrows test)) + (define tooltips (test-tooltips test)) + (define relative "list.rkt") + (define setup (test-setup test)) + (define teardown (test-teardown test)) + (define extra-files (test-extra-files test)) + (define extra-info? (test-extra-info? test)) + (define extra-file-paths + (for/list ([(name contents) (in-hash extra-files)]) + (define path (build-path save-dir name)) + (display-to-file contents path #:mode 'text) + path)) + + (define setup-result (setup)) + (define input + (if (procedure? pre-input) + (pre-input setup-result) + pre-input)) + (cond + [(dir-test? test) (insert-in-definitions drs (format input (path->require-string relative)))] + [else (insert-in-definitions drs input)]) + (click-check-syntax-and-check-errors drs test extra-info?) + + ;; need to check for syntax error here + (let ([got (get-annotated-output drs)] + [got-arrows (queue-callback/res (λ () (send defs syncheck:get-bindings-table)))]) + (when extra-info? + (printf "got-arrows\n") + (pretty-print got-arrows) + (newline) + + (printf "'drracket:syncheck:show-arrows? ~s\n" + (preferences:get 'drracket:syncheck:show-arrows?))) + (compare-output (cond + [(dir-test? test) + (map (lambda (x) + (list (if (eq? (car x) 'relative-path) + (path->require-string relative) + (car x)) + (cadr x))) + expected)] + [else expected]) + got + arrows + got-arrows + input + (test-line test))) + (when tooltips + (compare-tooltips (queue-callback/res (λ () (send defs syncheck:get-bindings-table #t))) + tooltips (test-line test))) - (when tooltips - (compare-tooltips (queue-callback/res (λ () (send defs syncheck:get-bindings-table #t))) - tooltips - (test-line test))) - - (teardown setup-result) - (for-each delete-directory/files extra-file-paths))] + + (teardown setup-result) + (for-each delete-directory/files extra-file-paths)] [(rename-test? test) (insert-in-definitions drs (rename-test-input test)) (click-check-syntax-and-check-errors drs test #f) From ded4cf5a6a4e2797e4460f457a5aa54ac6a490d6 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 00:31:52 +0000 Subject: [PATCH 11/11] Fix 1 occurrence of `map-to-for` This `map` operation can be replaced with a `for/list` loop. --- drracket-test/tests/drracket/syncheck-test.rkt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drracket-test/tests/drracket/syncheck-test.rkt b/drracket-test/tests/drracket/syncheck-test.rkt index 00cb592e5..5569a00a8 100644 --- a/drracket-test/tests/drracket/syncheck-test.rkt +++ b/drracket-test/tests/drracket/syncheck-test.rkt @@ -1850,12 +1850,11 @@ (preferences:get 'drracket:syncheck:show-arrows?))) (compare-output (cond [(dir-test? test) - (map (lambda (x) - (list (if (eq? (car x) 'relative-path) - (path->require-string relative) - (car x)) - (cadr x))) - expected)] + (for/list ([x (in-list expected)]) + (list (if (eq? (car x) 'relative-path) + (path->require-string relative) + (car x)) + (cadr x)))] [else expected]) got arrows