mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 01:58:16 +00:00
Add test function with regex
This commit is contained in:
parent
548f66e1cd
commit
9dea335a0a
1 changed files with 17 additions and 0 deletions
|
@ -26,6 +26,23 @@ proc do_execsql_test {test_name sql_statements expected_outputs} {
|
|||
}
|
||||
}
|
||||
|
||||
proc do_execsql_test_regex {test_name sql_statements expected_regex} {
|
||||
foreach db $::test_dbs {
|
||||
puts [format "(%s) %s Running test: %s" $db [string repeat " " [expr {40 - [string length $db]}]] $test_name]
|
||||
set combined_sql [string trim $sql_statements]
|
||||
set actual_output [evaluate_sql $::sqlite_exec $db $combined_sql]
|
||||
|
||||
# Validate the actual output against the regular expression
|
||||
if {![regexp $expected_regex $actual_output]} {
|
||||
puts "Test FAILED: '$sql_statements'"
|
||||
puts "returned '$actual_output'"
|
||||
puts "expected to match regex '$expected_regex'"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proc do_execsql_test_on_specific_db {db_name test_name sql_statements expected_outputs} {
|
||||
puts [format "(%s) %s Running test: %s" $db_name [string repeat " " [expr {40 - [string length $db_name]}]] $test_name]
|
||||
set combined_sql [string trim $sql_statements]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue