1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
source [file dirname [info script]]/testing.tcl
needs cmd regexp
testConstraint regexp_are [regexp {\d} 1]
needs constraint regexp_are
test regexpmin-1.1 {Minimal +} {
regexp -inline {x(a|b|c)+?c} xabcabc
} {xabc b}
test regexpmin-1.2 {Maximal +} {
regexp -inline {x(a|b|c)+c} xabcabc
} {xabcabc b}
test regexpmin-1.3 {Minimal *} {
regexp -inline {x(a|b)*?} xababcabc
} {x {}}
test regexpmin-1.4 {Maximal *} {
regexp -inline {x(a|b)*} xababcabc
} {xabab b}
test regexpmin-1.5 {Maximal ?} {
regexp -inline {x(a|b)?} xababcabc
} {xa a}
test regexpmin-1.6 {Minimal ?} {
regexp -inline {x(a|b)??} xababcabc
} {x {}}
test regexpmin-1.7 {Maximal html} {
regexp -inline {<(.+)>} <foo><bar><grill>
} {<foo><bar><grill> foo><bar><grill}
test regexpmin-1.8 {Minimal html} {
regexp -inline {<(.+?)>} <foo><bar><grill>
} {<foo> foo}
test regexpmin-2.1 {utf8 repeat} utf8 {
regexp -inline {a\u00df+} a\udf\udf\udf\udf\ub5z
} "a\udf\udf\udf\udf"
test regexpmin-2.2 {utf8 min repeat} utf8 {
regexp -inline {a\u00df+?} a\udf\udf\udf\udf\ub5z
} "a\udf"
test regexpmin-3.1 {non-capturing paren} {
regexp -inline {x(?:a|b)?} xababcabc
} {xa}
test regexpmin-3.2 {non-capturing paren} {
regexp -inline {x(?:a|b)?.*(b|c)} xababcabc
} {xababcabc c}
testreport
|