1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Enhance the do_test proc in the test suite so that if the expected result

is of the form "/.../" or "~/.../" then regular expression matching is done
between result and the "..." part of the expectation.  In the ~/.../ case,
we expect there to be no match.

FossilOrigin-Name: c9a734406c016329e80d887f7438206e41c52ce7
This commit is contained in:
drh
2012-04-27 01:08:02 +00:00
parent 9250581af4
commit 3f17aefb35
3 changed files with 24 additions and 12 deletions

View File

@ -474,7 +474,6 @@ proc incr_ntest {} {
# Invoke the do_test procedure to run a single test
#
proc do_test {name cmd expected} {
global argv cmdlinearg
fix_testname name
@ -505,11 +504,24 @@ proc do_test {name cmd expected} {
if {[catch {uplevel #0 "$cmd;\n"} result]} {
puts "\nError: $result"
fail_test $name
} elseif {[string compare $result $expected]} {
puts "\nExpected: \[$expected\]\n Got: \[$result\]"
fail_test $name
} else {
puts " Ok"
if {[regexp {^~?/.*/$} $expected]} {
if {[string index $expected 0]=="~"} {
set re [string range $expected 2 end-1]
set ok [expr {![regexp $re $result]}]
} else {
set re [string range $expected 1 end-1]
set ok [regexp $re $result]
}
} else {
set ok [expr {[string compare $result $expected]==0}]
}
if {!$ok} {
puts "\nExpected: \[$expected\]\n Got: \[$result\]"
fail_test $name
} else {
puts " Ok"
}
}
} else {
puts " Omitted"