From 116673c2e5890be0bfada8abc1a4ebc3ce316972 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 11 Aug 2025 10:00:45 +0200 Subject: [PATCH] Unify how SQL is executed in TCL tests --- testing/tester.tcl | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/testing/tester.tcl b/testing/tester.tcl index 6fbfa2dd5..14da8f214 100644 --- a/testing/tester.tcl +++ b/testing/tester.tcl @@ -127,11 +127,8 @@ proc do_execsql_test_tolerance {test_name sql_statements expected_outputs tolera } # This procedure passes the test if the output contains error messages proc run_test_expecting_any_error {sqlite_exec db_name sql} { - # Execute the SQL command and capture output - set command [list $sqlite_exec $db_name $sql] - # Use catch to handle both successful and error cases - catch {exec {*}$command} result options + catch {evaluate_sql $sqlite_exec $db_name $sql} result options # Check if the output contains error indicators (×, error, syntax error, etc.) if {[regexp {(error|ERROR|Error|×|syntax error|failed)} $result]} { @@ -148,11 +145,8 @@ proc run_test_expecting_any_error {sqlite_exec db_name sql} { # This procedure passes if error matches a specific pattern proc run_test_expecting_error {sqlite_exec db_name sql expected_error_pattern} { - # Execute the SQL command and capture output - set command [list $sqlite_exec $db_name $sql] - # Capture output whether command succeeds or fails - catch {exec {*}$command} result options + catch {evaluate_sql $sqlite_exec $db_name $sql} result options # Check if the output contains error indicators first if {![regexp {(error|ERROR|Error|×|syntax error|failed)} $result]} { @@ -177,11 +171,8 @@ proc run_test_expecting_error {sqlite_exec db_name sql expected_error_pattern} { # This version accepts exact error text, ignoring formatting proc run_test_expecting_error_content {sqlite_exec db_name sql expected_error_text} { - # Execute the SQL command and capture output - set command [list $sqlite_exec $db_name $sql] - # Capture output whether command succeeds or fails - catch {exec {*}$command} result options + catch {evaluate_sql $sqlite_exec $db_name $sql} result options # Check if the output contains error indicators first if {![regexp {(error|ERROR|Error|×|syntax error|failed)} $result]} {