-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automated Resyntax fixes #714
base: master
Are you sure you want to change the base?
Changes from all commits
3cc93d1
b3be073
2de1c08
042f6c4
ec35c55
e970f8b
7eef6c1
24b6900
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,8 @@ | |
"gui.rkt" | ||
"no-fw-test-util.rkt") | ||
|
||
(provide/contract | ||
[use-get/put-dialog (-> (-> any) path? void?)] | ||
[set-module-language! (->* () (boolean?) void?)]) | ||
(provide (contract-out [use-get/put-dialog (-> (-> any) path? void?)] | ||
[set-module-language! (->* () (boolean?) void?)])) | ||
|
||
(provide queue-callback/res | ||
fire-up-drracket-and-run-tests | ||
|
@@ -60,25 +59,25 @@ | |
;; filename is a string naming a file that should be typed into the dialog | ||
(define (use-get/put-dialog open-dialog filename) | ||
(not-on-eventspace-handler-thread 'use-get/put-dialog) | ||
(let ([drs (wait-for-drracket-frame)]) | ||
(with-handlers ([(lambda (x) #t) | ||
(lambda (x) | ||
(fw:preferences:set 'framework:file-dialogs 'std) | ||
(raise x))]) | ||
(fw:preferences:set 'framework:file-dialogs 'common) | ||
(open-dialog) | ||
(let ([dlg (wait-for-new-frame drs)]) | ||
(send (find-labelled-window "Filename:" #f (fw:test:get-active-top-level-window)) focus) | ||
(fw:test:keystroke #\a (list (case (system-type) | ||
[(windows) 'control] | ||
[(macosx macos) 'meta] | ||
[(unix) 'control] | ||
[else (error 'use-get/put-dialog "unknown platform: ~s\n" | ||
(system-type))]))) | ||
(for-each fw:test:keystroke (string->list (path->string filename))) | ||
(fw:test:button-push "OK") | ||
(wait-for-new-frame dlg)) | ||
(fw:preferences:set 'framework:file-dialogs 'std)))) | ||
(define drs (wait-for-drracket-frame)) | ||
(with-handlers ([(lambda (x) #t) (lambda (x) | ||
(fw:preferences:set 'framework:file-dialogs 'std) | ||
(raise x))]) | ||
(fw:preferences:set 'framework:file-dialogs 'common) | ||
(open-dialog) | ||
(let ([dlg (wait-for-new-frame drs)]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have been asking this a lot. I think one thing that would help is for the PR description to indicate if there's any limitation reached. If so, we wouldn't need to ask anymore if it's Resyntax's fault or not when some issues are not fixed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds like a great idea. |
||
(send (find-labelled-window "Filename:" #f (fw:test:get-active-top-level-window)) focus) | ||
(fw:test:keystroke | ||
#\a | ||
(list (case (system-type) | ||
[(windows) 'control] | ||
[(macosx macos) 'meta] | ||
[(unix) 'control] | ||
[else (error 'use-get/put-dialog "unknown platform: ~s\n" (system-type))]))) | ||
(for-each fw:test:keystroke (string->list (path->string filename))) | ||
(fw:test:button-push "OK") | ||
(wait-for-new-frame dlg)) | ||
(fw:preferences:set 'framework:file-dialogs 'std))) | ||
|
||
(define (test-util-error fmt . args) | ||
(raise (make-exn (apply fmt args) (current-continuation-marks)))) | ||
|
@@ -90,10 +89,7 @@ | |
(define (wait-for-drracket-frame [print-message? #f]) | ||
(define (wait-for-drracket-frame-pred) | ||
(define active (fw:test:get-active-top-level-window)) | ||
(if (and active | ||
(drracket-frame? active)) | ||
active | ||
#f)) | ||
(and (and active (drracket-frame? active)) active)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we only need one |
||
(define drr-fr | ||
(or (wait-for-drracket-frame-pred) | ||
(begin | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ and then loading the framework after that. | |
(define drr-frame (wait-for-drracket-frame)) | ||
(set-module-language! drr-frame) | ||
(queue-callback/res | ||
(λ () (send (send (send drr-frame get-definitions-text) get-canvas) focus))) | ||
(λ () (send+ drr-frame (get-definitions-text) (get-canvas) (focus)))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this one is a good change, actually. It isn't like the example in the documentation for |
||
(for ([x (in-string "(car 'x)")]) | ||
(test:keystroke x)) | ||
(let ([button (queue-callback/res (λ () (send drr-frame get-execute-button)))]) | ||
|
@@ -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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto (copied code, I wonder?!) |
||
(define drr-fr | ||
(or (wait-for-drracket-frame-pred) | ||
(begin | ||
|
@@ -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…") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,32 +99,30 @@ | |
(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 | ||
|
@@ -148,13 +146,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))]))))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is not a good change. This is going against the data definition. That is, the outer cond is part of the processing of |
||
(define output-passed? | ||
(let ([r (test-result test)]) | ||
((cond [(string? r) string=?] | ||
|
@@ -170,23 +165,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) | ||
|
@@ -225,9 +220,9 @@ | |
(for-each single-test (reverse tests)) | ||
(clear-definitions drs) | ||
(queue-callback/res (λ () (send (send drs get-definitions-text) set-modified #f))) | ||
(for ([file temp-files]) | ||
(when (file-exists? file) | ||
(delete-file file)))) | ||
(for ([file temp-files] | ||
#:when (file-exists? file)) | ||
(delete-file file))) | ||
|
||
(define (run-use-compiled-file-paths-tests) | ||
(define (setup-dialog/run proc) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like another situation where we are missing some newlines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sorawee