Debian Codegraph @

ext/text/test-line-edit.scm

raw
1 ;;-------------------------------------------------------------------
2 (use gauche.test)
3 (test-start "line-edit")
4 (test-section "line-edit")
5 (use text.line-edit)
6 (test-module 'text.line-edit)
7
8 ;; Test internal functions
9 (let ()
10 (define (t s pos expect)
11 (test* #"buffer-find-matching-paren: ~s ~pos" expect
12 ((with-module text.line-edit buffer-find-matching-paren)
13 ((with-module text.gap-buffer string->gap-buffer) s)
14 0 pos)))
15
16 (t "(abc)" 4 0)
17 (t "aa(abc)zz" 6 2)
18 (t "(a(abc)z)" 6 2)
19 (t "(a)(abc)z" 7 3)
20 (t "(a\\(b)z" 5 0)
21 (t "(a\\(\\))z" 6 0)
22 (t "(a\\)\\()z" 6 0)
23 (t "(a(abc)(def)z)" 11 7)
24 (t "(a(abc)(def)z)" 13 0)
25 (t "aaaabc)zz" 6 #f)
26 (t "(a{b}c)" 4 2)
27 (t "(a{b}c)" 6 0)
28 (t "(a{b(}c)" 5 #f)
29 (t "(a{b(}c)" 7 4)
30 (t "(a{b)}c)" 4 #f)
31 (t "(a{b)}c)" 5 2)
32 (t "(a\"(\"b)" 6 0)
33 (t "(a\")\"b)" 6 0)
34 (t "(a\"\\\"(\"b)" 8 0)
35 (t "(a#/bc([d\\//)]" 12 0)
36 (t "(a#/bc([d\\//)]" 13 #f)
37 (t "(a#(b)c)" 5 3)
38 (t "(a#(b)c)" 7 0)
39 (t "(a#[b[:space:]]c)" 14 3)
40 (t "(a#[b[:space:]]c)" 13 5)
41 (t "(a#[b[:space:]]c)" 16 0)
42 (t "(a#{b}c)" 5 3)
43 (t "(a#{b)c}" 5 #f)
44 (t "(a#{b)c}" 7 3)
45 (t "(a\\#(b)c)" 6 4)
46 (t "(a#\\(b)c)" 6 0)
47 )
48
49 (test-end)