Skip to content
Open
2 changes: 1 addition & 1 deletion drracket-core-lib/drracket/private/debug.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@
[(null? (cdr planet-version))
(format "~s" `(,(car planet-version) ?))]
[else
(format "~s" `(,(car planet-version) ,(cadr planet-version)))]))
(format "~s" (list (car planet-version) (cadr planet-version)))]))
(cons 'description (exn->trace exn)))]
[else #f]))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]))

Expand Down Expand Up @@ -159,11 +159,11 @@
(if sd (list sd) null))])
(λ (p)
(define skip-in-paths? (file-stamp-in-paths p no-dirs))
(define pkg (path->pkg p #:cache path->pkg-cache))
(define skip-pkgs?
(let ([pkg (path->pkg p #:cache path->pkg-cache)])
(and pkg
(not (set-member? open-pkgs pkg))
(file-stamp-in-paths p (list (pkg-directory/use-cache pkg))))))
(and pkg
(not (set-member? open-pkgs pkg))
(file-stamp-in-paths p (list (pkg-directory/use-cache pkg)))))
(log-drracket/cm-info "~a; skip? ~a ~a thd ~a"
p
(and skip-in-paths? #t)
Expand Down
17 changes: 9 additions & 8 deletions drracket-core-lib/drracket/private/honu-logo.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@
little-fin-bottom-y))

(define (add-dot path x y)
(let ([p (new dc-path%)])
(send p ellipse (- x 2) (- y 2) 4 4)
(send path append p)))
(define p (new dc-path%))
(send p ellipse (- x 2) (- y 2) 4 4)
(send path append p))

(define (same-side-add x1 y1 x2 y2 x3 y3 x4 y4)
(send body-path curve-to x2 y2 x3 y3 x4 y4))
Expand All @@ -193,11 +193,12 @@
(add-dot body-path x3 y3))

(define (opposite-side-add x1 y1 x2 y2 x3 y3 x4 y4)
(let ([conv (lambda (x y) (values (+ (- x) body-width) y))])
(let-values ([(cx1 cy1) (conv x1 y1)]
[(cx2 cy2) (conv x2 y2)]
[(cx3 cy3) (conv x3 y3)])
(send body-path curve-to cx3 cy3 cx2 cy2 cx1 cy1))))
(define (conv x y)
(values (+ (- x) body-width) y))
(define-values (cx1 cy1) (conv x1 y1))
(define-values (cx2 cy2) (conv x2 y2))
(define-values (cx3 cy3) (conv x3 y3))
(send body-path curve-to cx3 cy3 cx2 cy2 cx1 cy1))

(define (opposite-side-add/dot x1 y1 x2 y2 x3 y3 x4 y4)
(let ([conv (lambda (x y) (values (+ (- x) body-width) y))])
Expand Down
12 changes: 6 additions & 6 deletions drracket-core-lib/drracket/private/stack-checkpoint.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@
interesting-editor-editions)

(define (add-editions-to-interesting-editors editions interesting-editor-editions)
(for ([edition (in-list editions)])
(when edition
(match-define (cons wb edition-number) edition)
(define ed (weak-box-value wb))
(when ed
(hash-set! interesting-editor-editions ed edition)))))
(for ([edition (in-list editions)]
#:when edition)
(match-define (cons wb edition-number) edition)
(define ed (weak-box-value wb))
(when ed
(hash-set! interesting-editor-editions ed edition))))

(define (empty-viewable-stack? a-viewable-stack)
(match-define (viewable-stack stack-items _ _ _ _)
Expand Down
328 changes: 160 additions & 168 deletions drracket-test/tests/drracket/private/drracket-test-util.rkt

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions drracket-test/tests/drracket/private/easter-egg-lib.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,12 @@ and then loading the framework after that.
(define (wait-for-drracket-frame [print-message? #f])
(define (wait-for-drracket-frame-pred)
(define active (test:get-active-top-level-window))
(if (and active
(drracket-frame? active))
active
#f))
(and (and active (drracket-frame? active)) active))
(define drr-fr
(or (wait-for-drracket-frame-pred)
(begin
(when print-message?
(printf "Select DrRacket frame\n"))
(displayln "Select DrRacket frame"))
(poll-until wait-for-drracket-frame-pred))))
(when drr-fr
(wait-for-events-in-frame-eventspace drr-fr))
Expand All @@ -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…")
Expand Down
94 changes: 44 additions & 50 deletions drracket-test/tests/drracket/private/module-lang-test-utils.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -155,13 +152,10 @@
(let loop ([snip (send interactions-text find-first-snip)])
(cond
[(not snip) '()]
[else
(cond
[(method-in-interface? 'get-stacks (object-interface snip))
(define-values (s1 s2) (send snip get-stacks))
(list* s1 s2 (loop (send snip next)))]
[else
(loop (send snip next))])])))))
[(method-in-interface? 'get-stacks (object-interface snip))
(define-values (s1 s2) (send snip get-stacks))
(list* s1 s2 (loop (send snip next)))]
[else (loop (send snip next))])))))
(define output-passed?
(let ([r (if separate-process?
(test-separate-process-result test)
Expand All @@ -179,23 +173,23 @@
text)
(unless (null? stacks)
(eprintf "stacks from error message:\n")
(for ([stack (in-list stacks)])
(when stack
(eprintf "\n----\n")
(unless (empty-viewable-stack? stack)
(define stack-iterator (copy-viewable-stack stack))
(let loop ()
(define-values (list-of-srcloc-count has-next?)
(viewable-stack-get-next-items! stack-iterator))
(for ([srcloc-count (in-list list-of-srcloc-count)])
(define frame (srcloc->string (car srcloc-count)))
(define count (+ 1 (cdr srcloc-count)))
(if (> count 1)
(eprintf " ~a [repeated ~a times]\n" frame count)
(eprintf " ~a\n" frame)))
(when has-next?
(loop))))
(eprintf "----\n")))))
(for ([stack (in-list stacks)]
#:when stack)
(eprintf "\n----\n")
(unless (empty-viewable-stack? stack)
(define stack-iterator (copy-viewable-stack stack))
(let loop ()
(define-values (list-of-srcloc-count has-next?)
(viewable-stack-get-next-items! stack-iterator))
(for ([srcloc-count (in-list list-of-srcloc-count)])
(define frame (srcloc->string (car srcloc-count)))
(define count (+ 1 (cdr srcloc-count)))
(if (> count 1)
(eprintf " ~a [repeated ~a times]\n" frame count)
(eprintf " ~a\n" frame)))
(when has-next?
(loop))))
(eprintf "----\n"))))
(define the-assert (test-extra-assert test))
(define-values (kws-req kws-acc) (procedure-keywords the-assert))
(define-values (kws kw-vals)
Expand Down
61 changes: 31 additions & 30 deletions drracket-test/tests/drracket/private/repl-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -1130,20 +1131,20 @@ This produces an ACK message
(eprintf "FAILED execute test for ~s\n expected interactions to have the focus\n"
program))]
[defs-focus?
(let ([start (car source-location)]
[finish (cdr source-location)])
(let* ([error-ranges (queue-callback/res (λ () (send ints-text get-error-ranges)))]
[error-range (and error-ranges (not (null? error-ranges)) (car error-ranges))])
(unless (and error-range
(= (+ (srcloc-position error-range) -1) (loc-offset start))
(= (+ (srcloc-position error-range) -1 (srcloc-span error-range))
(loc-offset finish)))
(eprintf "FAILED execute test for ~s\n error-range is ~s\n expected ~s\n"
program
(and error-range
(list (+ (srcloc-position error-range) -1)
(+ (srcloc-position error-range) -1 (srcloc-span error-range))))
(list (loc-offset start) (loc-offset finish))))))])])
(define start (car source-location))
(define finish (cdr source-location))
(define error-ranges (queue-callback/res (λ () (send ints-text get-error-ranges))))
(define error-range (and error-ranges (not (null? error-ranges)) (car error-ranges)))
(unless (and error-range
(= (+ (srcloc-position error-range) -1) (loc-offset start))
(= (+ (srcloc-position error-range) -1 (srcloc-span error-range))
(loc-offset finish)))
(eprintf "FAILED execute test for ~s\n error-range is ~s\n expected ~s\n"
program
(and error-range
(list (+ (srcloc-position error-range) -1)
(+ (srcloc-position error-range) -1 (srcloc-span error-range))))
(list (loc-offset start) (loc-offset finish))))])])

; check text for execute test
(next-test)
Expand Down Expand Up @@ -1192,21 +1193,21 @@ This produces an ACK message
(test:run-one (λ () (send (send drr-frame get-break-button) command))))
(wait-for-drr-frame-computation)

(let* ([load-text-end (- (get-int-pos) 1)] ;; subtract one to eliminate newline
[received-load (fetch-output drr-frame load-text-start load-text-end)])

;; check load text
(next-test)
(unless (cond
[(string? load-answer) (string=? load-answer received-load)]
[(regexp? load-answer) (regexp-match load-answer received-load)]
[else #f])
(failure)
(eprintf "FAILED load test ~a for ~s\n expected: ~s\n got: ~s\n"
short-filename
program
load-answer
received-load))))
(define load-text-end (- (get-int-pos) 1)) ;; subtract one to eliminate newline
(define received-load (fetch-output drr-frame load-text-start load-text-end))
;; check load text
(next-test)
(unless (cond
[(string? load-answer) (string=? load-answer received-load)]
[(regexp? load-answer) (regexp-match load-answer received-load)]
[else #f])
(failure)
(eprintf "FAILED load test ~a for ~s\n expected: ~s\n got: ~s\n"
short-filename
program
load-answer
received-load)))
(load-test tmp-load-short-filename (make-load-answer in-vector language-cust #f))
(when (file-exists? tmp-load3-filename)
(delete-file tmp-load3-filename))
Expand Down
Loading