Skip to content

Commit

Permalink
add a few test cases that cover the basics of the highlighting of inv…
Browse files Browse the repository at this point in the history
…isible parens
  • Loading branch information
rfindler committed Jul 23, 2024
1 parent 6754ed4 commit 33af614
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
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

0 comments on commit 33af614

Please sign in to comment.