mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
The expected result in a test case can be of the form "*glob*" or "~*glob*" to
match or not match the GLOB pattern. This is useful for matching EXPLAIN QUERY PLAN output that contains regular expression syntax characters like "?", "(", and ")". FossilOrigin-Name: a3b4e261bd7e278f150872cce7b020af5ad8d2ed
This commit is contained in:
@ -551,6 +551,9 @@ proc do_test {name cmd expected} {
|
||||
fail_test $name
|
||||
} else {
|
||||
if {[regexp {^~?/.*/$} $expected]} {
|
||||
# "expected" is of the form "/PATTERN/" then the result if correct if
|
||||
# regular expression PATTERN matches the result. "~/PATTERN/" means
|
||||
# the regular expression must not match.
|
||||
if {[string index $expected 0]=="~"} {
|
||||
set re [string map {# {[-0-9.]+}} [string range $expected 2 end-1]]
|
||||
set ok [expr {![regexp $re $result]}]
|
||||
@ -558,6 +561,16 @@ proc do_test {name cmd expected} {
|
||||
set re [string map {# {[-0-9.]+}} [string range $expected 1 end-1]]
|
||||
set ok [regexp $re $result]
|
||||
}
|
||||
} elseif {[regexp {^~?\*.*\*$} $expected]} {
|
||||
# "expected" is of the form "*GLOB*" then the result if correct if
|
||||
# glob pattern GLOB matches the result. "~/GLOB/" means
|
||||
# the glob must not match.
|
||||
if {[string index $expected 0]=="~"} {
|
||||
set e [string range $expected 1 end]
|
||||
set ok [expr {![string match $e $result]}]
|
||||
} else {
|
||||
set ok [string match $expected $result]
|
||||
}
|
||||
} else {
|
||||
set ok [expr {[string compare $result $expected]==0}]
|
||||
}
|
||||
|
Reference in New Issue
Block a user