Skip to content

Commit 34bf9de

Browse files
Automated Resyntax fixes (#681)
This is an automated change generated by Resyntax. #### Pass 1 Applied 1 fix to [`drracket-test/tests/drracket/repl-test-raw.rkt`](../blob/HEAD/drracket-test/tests/drracket/repl-test-raw.rkt) * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. Applied 4 fixes to [`drracket-test/tests/drracket/populate-compiled.rkt`](../blob/HEAD/drracket-test/tests/drracket/populate-compiled.rkt) * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. * Line 12, `make-temporary-directory-migration`: Use `make-temporary-directory` to make directories instead of `make-temporary-file`. * Line 82, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. * Line 97, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. Applied 3 fixes to [`drracket/drracket/private/honu-logo.rkt`](../blob/HEAD/drracket/drracket/private/honu-logo.rkt) * Line 12, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 18, `define-lambda-to-define`: The `define` form supports a shorthand for defining functions (including function-returning functions). * Line 131, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. Applied 1 fix to [`drracket-test/tests/drracket/module-browser.rkt`](../blob/HEAD/drracket-test/tests/drracket/module-browser.rkt) * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. Applied 1 fix to [`drracket/drracket/syncheck-drracket-button.rkt`](../blob/HEAD/drracket/drracket/syncheck-drracket-button.rkt) * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. ## Summary Fixed 10 issues in 5 files. * Fixed 5 occurrences of `tidy-require` * Fixed 3 occurrences of `let-to-define` * Fixed 1 occurrence of `make-temporary-directory-migration` * Fixed 1 occurrence of `define-lambda-to-define` Co-authored-by: GitHub Actions <[email protected]>
1 parent 582b84f commit 34bf9de

File tree

5 files changed

+98
-111
lines changed

5 files changed

+98
-111
lines changed

drracket-test/tests/drracket/module-browser.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#lang racket/base
2-
(require racket/unit
2+
(require drracket/private/standalone-module-browser
33
racket/async-channel
4-
drracket/private/standalone-module-browser
4+
racket/unit
55
rackunit)
66

77
(define (fetch-files stx/fn)

drracket-test/tests/drracket/populate-compiled.rkt

Lines changed: 47 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#lang racket/base
2-
(require racket/file
3-
racket/system
4-
compiler/find-exe
5-
pkg/lib)
2+
(require compiler/find-exe
3+
pkg/lib
4+
racket/file
5+
racket/system)
66

77
(module test racket/base) ; disable for DrDr
88

99
(unless (eq? 'user (default-pkg-scope))
1010
(error "Run this test with `user' default package scope"))
1111

12-
(define dir (make-temporary-file "~a" 'directory))
12+
(define dir (make-temporary-directory "~a"))
1313
(define pkg-dir (build-path dir "popcomp-pkg"))
1414
(define coll-dir (build-path pkg-dir "popcomp"))
1515
(define pkg2-dir (build-path dir "popcomp2-pkg"))
@@ -79,12 +79,12 @@
7979
;; ----------------------------------------
8080

8181
(module go racket/base
82-
(require "private/drracket-test-util.rkt"
83-
racket/gui/base
82+
(require framework/test
8483
racket/class
85-
racket/path
8684
racket/file
87-
framework/test)
85+
racket/gui/base
86+
racket/path
87+
"private/drracket-test-util.rkt")
8888

8989
(define (check-compiled compiled? path)
9090
(unless (equal? compiled? (file-exists? path))
@@ -95,59 +95,55 @@
9595

9696
(fire-up-drracket-and-run-tests
9797
(λ ()
98-
(let ([drs (wait-for-drracket-frame)])
99-
(define x (vector-ref (current-command-line-arguments) 0))
100-
(define dir (path-only x))
101-
102-
(do-execute drs)
98+
(define drs (wait-for-drracket-frame))
99+
(define x (vector-ref (current-command-line-arguments) 0))
100+
(define dir (path-only x))
101+
102+
(do-execute drs)
103+
104+
(define popcomp-main-zo
105+
(build-path dir "popcomp-pkg" "popcomp" "compiled" "drracket" "errortrace" "main_rkt.zo"))
106+
(define popcomp2-main-zo
107+
(build-path dir "popcomp2-pkg" "popcomp2" "compiled" "drracket" "errortrace" "main_rkt.zo"))
103108

104-
(define popcomp-main-zo
105-
(build-path dir "popcomp-pkg" "popcomp" "compiled" "drracket" "errortrace" "main_rkt.zo"))
106-
(define popcomp2-main-zo
107-
(build-path dir "popcomp2-pkg" "popcomp2" "compiled" "drracket" "errortrace" "main_rkt.zo"))
109+
(check-compiled #t (build-path dir "compiled" "drracket" "errortrace" "y_rkt.zo"))
110+
(check-compiled #f popcomp-main-zo)
111+
(check-compiled #f popcomp2-main-zo)
108112

109-
(check-compiled #t (build-path dir "compiled" "drracket" "errortrace" "y_rkt.zo"))
110-
(check-compiled #f popcomp-main-zo)
111-
(check-compiled #f popcomp2-main-zo)
113+
;; Create a broken ".zo" file where it should not be used:
114+
(make-directory* (path-only popcomp-main-zo))
115+
(call-with-output-file* popcomp-main-zo (lambda (o) (fprintf o "broken\n")))
112116

113-
;; Create a broken ".zo" file where it should not be used:
114-
(make-directory* (path-only popcomp-main-zo))
115-
(call-with-output-file*
116-
popcomp-main-zo
117-
(lambda (o)
118-
(fprintf o "broken\n")))
117+
(do-execute drs)
118+
(let* ([got (fetch-output drs)])
119+
(unless (string=? "" got)
120+
(error 'check-output "wrong output: ~s" got)))
119121

120-
(do-execute drs)
121-
(let* ([got (fetch-output drs)])
122-
(unless (string=? "" got)
123-
(error 'check-output "wrong output: ~s" got)))
122+
(delete-file popcomp-main-zo)
124123

125-
(delete-file popcomp-main-zo)
124+
;; Open "main.rkt" in "popcomp-pkg", so now it should be compiled
125+
;; when we run "x.rkt":
126126

127-
;; Open "main.rkt" in "popcomp-pkg", so now it should be compiled
128-
;; when we run "x.rkt":
127+
(test:menu-select "File" "New Tab")
128+
(use-get/put-dialog (λ () (test:menu-select "File" "Open…"))
129+
(build-path dir "popcomp-pkg" "popcomp" "main.rkt"))
129130

130-
(test:menu-select "File" "New Tab")
131-
(use-get/put-dialog (λ ()
132-
(test:menu-select "File" "Open…"))
133-
(build-path dir "popcomp-pkg" "popcomp" "main.rkt"))
131+
(queue-callback/res (λ () (send drs change-to-tab (car (send drs get-tabs)))))
134132

135-
(queue-callback/res (λ () (send drs change-to-tab (car (send drs get-tabs)))))
133+
(do-execute drs)
136134

137-
(do-execute drs)
135+
(check-compiled #t popcomp-main-zo)
136+
(check-compiled #f popcomp2-main-zo)
138137

139-
(check-compiled #t popcomp-main-zo)
140-
(check-compiled #f popcomp2-main-zo)
138+
;; But if the "popcomp-pkg" directory is not writable, then
139+
;; don't compile after all:
141140

142-
;; But if the "popcomp-pkg" directory is not writable, then
143-
;; don't compile after all:
141+
(delete-file popcomp-main-zo)
142+
(file-or-directory-permissions (build-path dir "popcomp-pkg") #o555)
144143

145-
(delete-file popcomp-main-zo)
146-
(file-or-directory-permissions (build-path dir "popcomp-pkg") #o555)
147-
148-
(do-execute drs)
144+
(do-execute drs)
149145

150-
(check-compiled #f popcomp-main-zo)
151-
(check-compiled #f popcomp2-main-zo)
146+
(check-compiled #f popcomp-main-zo)
147+
(check-compiled #f popcomp2-main-zo)
152148

153-
(file-or-directory-permissions (build-path dir "popcomp-pkg") #o777)))))
149+
(file-or-directory-permissions (build-path dir "popcomp-pkg") #o777))))

drracket-test/tests/drracket/repl-test-raw.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#lang racket/base
2-
(require "private/repl-test.rkt" "private/drracket-test-util.rkt")
2+
(require "private/drracket-test-util.rkt"
3+
"private/repl-test.rkt")
34
(fire-up-drracket-and-run-tests (λ () (run-test '(raw))))
45

56
(module+ test

drracket/drracket/private/honu-logo.rkt

Lines changed: 44 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,41 @@
1010
(define body-path (make-object dc-path%))
1111

1212
(define (find-arc-spot x y w h end)
13-
(let ([ce (cos end)]
14-
[se (- (sin end))])
15-
(values (+ x (* w 1/2) (* w 1/2 ce))
16-
(+ y (* h 1/2) (* h 1/2 se)))))
17-
18-
(define weighted-arc
19-
(lambda (path x y w h start end ccw? [dx1 0.0] [dy1 0.2] [dx2 dx1] [dy2 (- dy1)])
20-
(let ([sweep (let loop ([s (if ccw? (- end start) (- start end))])
21-
(if (< s 0)
22-
(loop (+ s (* 2 pi)))
23-
s))])
24-
(if (> sweep pi)
25-
(let ([halfway ((if ccw? + -) start (/ sweep 2))])
26-
(weighted-arc path x y w h start halfway ccw? dx1 dy1 dx2 dy2)
27-
(weighted-arc path x y w h halfway end ccw? dx2 (- dy2) dx1 (- dy1)))
28-
(let ([p (new dc-path%)])
29-
;; Set p to be the arc for a unit circle,
30-
;; centered on the X-axis:
31-
(let* ([x0 (cos (/ sweep 2))]
32-
[y0 (sin (/ sweep 2))]
33-
[x1 (/ (- 4 x0) 3)]
34-
[y1 (/ (* (- 1 x0) (- 3 x0)) (* 3 y0))]
35-
[x2 x1]
36-
[y2 (- y1)]
37-
[x3 x0]
38-
[y3 (- y0)]
39-
[sw (/ w 2)]
40-
[sh (/ h 2)])
41-
(send p move-to x0 y0)
42-
(send p curve-to
43-
(+ x1 dx1) (+ y1 dy1)
44-
(+ x2 dx2) (+ y2 dy2)
45-
x3 y3)
46-
;; Rotate to match start:
47-
(send p rotate (+ (if ccw? start end) (/ sweep 2)))
48-
;; Scale to match width and height:
49-
(send p scale (/ w 2) (/ h 2))
50-
;; Translate to match x and y
51-
(send p translate (+ x (/ w 2)) (+ y (/ h 2)))
52-
(unless ccw?
53-
(send p reverse)))
54-
(send path append p))))))
13+
(define ce (cos end))
14+
(define se (- (sin end)))
15+
(values (+ x (* w 1/2) (* w 1/2 ce)) (+ y (* h 1/2) (* h 1/2 se))))
16+
17+
(define (weighted-arc path x y w h start end ccw? [dx1 0.0] [dy1 0.2] [dx2 dx1] [dy2 (- dy1)])
18+
(let ([sweep (let loop ([s (if ccw? (- end start) (- start end))])
19+
(if (< s 0) (loop (+ s (* 2 pi))) s))])
20+
(if (> sweep pi)
21+
(let ([halfway ((if ccw? + -) start (/ sweep 2))])
22+
(weighted-arc path x y w h start halfway ccw? dx1 dy1 dx2 dy2)
23+
(weighted-arc path x y w h halfway end ccw? dx2 (- dy2) dx1 (- dy1)))
24+
(let ([p (new dc-path%)])
25+
;; Set p to be the arc for a unit circle,
26+
;; centered on the X-axis:
27+
(let* ([x0 (cos (/ sweep 2))]
28+
[y0 (sin (/ sweep 2))]
29+
[x1 (/ (- 4 x0) 3)]
30+
[y1 (/ (* (- 1 x0) (- 3 x0)) (* 3 y0))]
31+
[x2 x1]
32+
[y2 (- y1)]
33+
[x3 x0]
34+
[y3 (- y0)]
35+
[sw (/ w 2)]
36+
[sh (/ h 2)])
37+
(send p move-to x0 y0)
38+
(send p curve-to (+ x1 dx1) (+ y1 dy1) (+ x2 dx2) (+ y2 dy2) x3 y3)
39+
;; Rotate to match start:
40+
(send p rotate (+ (if ccw? start end) (/ sweep 2)))
41+
;; Scale to match width and height:
42+
(send p scale (/ w 2) (/ h 2))
43+
;; Translate to match x and y
44+
(send p translate (+ x (/ w 2)) (+ y (/ h 2)))
45+
(unless ccw?
46+
(send p reverse)))
47+
(send path append p)))))
5548

5649
(define overall-rotation (- (* pi 1/2 3/8)))
5750

@@ -129,18 +122,15 @@
129122
(+ (* pi 3/2) angle-offset)))
130123

131124
(define (add-big-fin-top add)
132-
(let ([fin-width (- big-fin-right-edge big-fin-top-x)])
133-
(add big-fin-top-x
134-
big-fin-top-y
135-
136-
(+ big-fin-top-x (* 1/3 fin-width))
137-
big-fin-curve-top-offset
138-
139-
(+ big-fin-top-x (* 2/3 fin-width))
140-
big-fin-curve-top-offset
141-
142-
big-fin-right-edge
143-
(+ big-fin-bottom-y 10))))
125+
(define fin-width (- big-fin-right-edge big-fin-top-x))
126+
(add big-fin-top-x
127+
big-fin-top-y
128+
(+ big-fin-top-x (* 1/3 fin-width))
129+
big-fin-curve-top-offset
130+
(+ big-fin-top-x (* 2/3 fin-width))
131+
big-fin-curve-top-offset
132+
big-fin-right-edge
133+
(+ big-fin-bottom-y 10)))
144134

145135
(define (add-big-fin-bottom add)
146136
(let ([fin-width (- big-fin-right-edge big-fin-bottom-x)])

drracket/drracket/syncheck-drracket-button.rkt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#lang racket/base
2-
(require racket/class
3-
string-constants/string-constant
2+
(require (for-syntax images/icons/style images/icons/tool racket/base)
43
images/compile-time
5-
(for-syntax racket/base images/icons/tool images/icons/style))
4+
racket/class
5+
string-constants/string-constant)
66
(provide syncheck-drracket-button
77
syncheck-bitmap
88
syncheck-small-bitmap

0 commit comments

Comments
 (0)