Skip to content
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

add a few test cases that cover the basics of the highlighting of invisible parens #332

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion gui-test/framework/tests/racket.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,17 @@
(text:range-end r)))
range<?))

;; useful for testing invisible parens
(define (check-shrub-parens str pos)
(define prefix "#lang shrubbery\n")
(define pl (string-length prefix))
(define res
(check-parens (string-append prefix str)
(+ pos pl)))
(for/list ([item (in-list res)])
(list (- (list-ref item 0) pl)
(- (list-ref item 1) pl))))

(define (range<? r1 r2)
(cond
[(= (list-ref r1 0) (list-ref r2 0))
Expand All @@ -364,7 +375,11 @@
(check-equal? (check-parens "x" 0) '())
(check-equal? (check-parens "()" 0) '((0 2)))
(check-equal? (check-parens "(())" 0) '((0 4) (1 3)))
(check-equal? (check-parens "( () () )" 0) '((0 9) (2 4) (5 7))))
(check-equal? (check-parens "( () () )" 0) '((0 9) (2 4) (5 7)))
(check-equal? (check-shrub-parens "1+2" 0) '((0 3)))
(check-equal? (check-shrub-parens " 1+2\n 3+4" 1) '((1 4) (1 9) (6 9)))
(check-equal? (check-shrub-parens " 1+2\n 3+4" 4) '((1 4)))
(check-equal? (check-shrub-parens "block:\n 1+2\n 3+4" 0) '((0 16) (8 11) (8 16) (13 16))))

(define (test-indentation before)
(define t (new racket:text%))
Expand Down
3 changes: 2 additions & 1 deletion gui-test/info.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"sandbox-lib"
"simple-tree-text-markup-lib"
"pict-lib"
"pict-snip-lib"))
"pict-snip-lib"
"shrubbery-lib"))
(define update-implies '("gui-lib"))

(define pkg-desc "tests for \"gui\"")
Expand Down
Loading