diff options
author | fvogel <fvogelnew1@free.fr> | 2018-10-17 19:57:56 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2018-10-17 19:57:56 (GMT) |
commit | fc97bb501230f56b586416d0158380d5bb3ade3b (patch) | |
tree | a9b7fad20c105400be3c2f30d6220a471bfea1ff /tests/text.test | |
parent | 3f2088affeee65dd4f0653429128dfa0a125d1ab (diff) | |
parent | 566cd6cc4d43ac0be15b5f02975566c38e4e4e5f (diff) | |
download | tk-fc97bb501230f56b586416d0158380d5bb3ade3b.zip tk-fc97bb501230f56b586416d0158380d5bb3ade3b.tar.gz tk-fc97bb501230f56b586416d0158380d5bb3ade3b.tar.bz2 |
Fix [4b555aca34]: text search -all hangs and eats all memory
Diffstat (limited to 'tests/text.test')
-rw-r--r-- | tests/text.test | 214 |
1 files changed, 213 insertions, 1 deletions
diff --git a/tests/text.test b/tests/text.test index f5225d9..45acc7b 100644 --- a/tests/text.test +++ b/tests/text.test @@ -5885,7 +5885,219 @@ test text-22.225 {TextSearchCmd, strict limits} -body { } -cleanup { destroy .t } -result {} - +test text-22.226 {TextSearchCmd, exact search for the empty string} -body { + text .t + set res [.t search -count C "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.227 {TextSearchCmd, exact search for the empty string} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C "" 2.5] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.5 0} +test text-22.228 {TextSearchCmd, exact search all empty strings} -body { + text .t + set res [.t search -count C -all "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.229 {TextSearchCmd, exact search all empty strings} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -all "" 2.5 2.8] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.5 2.6 2.7 {0 0 0}} +test text-22.230 {TextSearchCmd, exact search all empty strings, with overlap} -body { + text .t + set res [.t search -count C -all -overlap "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.231 {TextSearchCmd, exact search all empty strings, with overlap} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -all -overlap "" 2.5 2.8] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.5 2.6 2.7 {0 0 0}} +test text-22.232 {TextSearchCmd, regexp search for the empty string} -body { + text .t + set res [.t search -count C -regexp "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.233 {TextSearchCmd, regexp search for the empty string} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -regexp "" 2.5] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.5 0} +test text-22.234 {TextSearchCmd, regexp search all empty strings} -body { + text .t + set res [.t search -count C -all -regexp "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.235 {TextSearchCmd, regexp search all empty strings} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -all -regexp "" 2.5 2.8] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.5 2.6 2.7 {0 0 0}} +test text-22.236 {TextSearchCmd, regexp search all empty strings, with overlap} -body { + text .t + set res [.t search -count C -all -regexp -overlap "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.237 {TextSearchCmd, regexp search all empty strings, with overlap} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -all -regexp -overlap "" 2.5 2.8] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.5 2.6 2.7 {0 0 0}} +test text-22.238 {TextSearchCmd, exact backwards search for the empty string} -body { + text .t + set res [.t search -count C -backwards "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.239 {TextSearchCmd, exact backwards search for the empty string} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -backwards "" 2.5] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.4 0} +test text-22.240 {TextSearchCmd, exact backwards search all empty strings} -body { + text .t + set res [.t search -count C -backwards -all "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.241 {TextSearchCmd, exact backwards search all empty strings} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -backwards -all "" 2.5 2.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.4 2.3 2.2 2.1 2.0 {0 0 0 0 0}} +test text-22.242 {TextSearchCmd, exact backwards search all empty strings, with overlap} -body { + text .t + set res [.t search -count C -backwards -all -overlap "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.243 {TextSearchCmd, exact backwards search all empty strings, with overlap} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -backwards -all -overlap "" 2.5 2.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.4 2.3 2.2 2.1 2.0 {0 0 0 0 0}} +test text-22.244 {TextSearchCmd, regexp backwards search for the empty string} -body { + text .t + set res [.t search -count C -backwards -regexp "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.245 {TextSearchCmd, regexpbackwards search for the empty string} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -backwards -regexp "" 2.5] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.4 0} +test text-22.246 {TextSearchCmd, regexp backwards search all empty strings} -body { + text .t + set res [.t search -count C -backwards -all -regexp "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.247 {TextSearchCmd, regexp backwards search all empty strings} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -backwards -all -regexp "" 2.5 2.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.4 2.3 2.2 2.1 2.0 {0 0 0 0 0}} +test text-22.248 {TextSearchCmd, regexp backwards search all empty strings, with overlap} -body { + text .t + set res [.t search -count C -backwards -all -regexp -overlap "" 1.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {1.0 0} +test text-22.249 {TextSearchCmd, regexp backwards search all empty strings, with overlap} -body { + text .t + .t insert end "Searching for the\nempty string!" + set res [.t search -count C -backwards -all -regexp -overlap "" 2.5 2.0] + lappend res $C +} -cleanup { + destroy .t + unset -nocomplain res C +} -result {2.4 2.3 2.2 2.1 2.0 {0 0 0 0 0}} +test text-22.250 {TextSearchCmd, backwards search all matching at start of line} -body { + text .t + .t insert end "abc" + set res [.t search -backwards -all b end] ; # works + lappend res [.t search -backwards a end] ; # works + lappend res [.t search -backwards -all a end] ; # used to hang +} -cleanup { + destroy .t +} -result {1.1 1.0 1.0} test text-23.1 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100 |