diff --git a/core/translate/expr.rs b/core/translate/expr.rs index afdb6c7ad..275851201 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -1600,7 +1600,7 @@ pub fn translate_expr( program.emit_insn(Insn::Copy { src_reg: output_register, dst_reg: target_register, - amount: 1, + amount: 0, }); Ok(target_register) } diff --git a/testing/scalar-functions.test b/testing/scalar-functions.test index e7f1c1b10..f04fa1765 100755 --- a/testing/scalar-functions.test +++ b/testing/scalar-functions.test @@ -809,6 +809,10 @@ do_execsql_test cast-small-float-to-numeric { SELECT typeof(CAST('1.23' AS NUMERIC)), CAST('1.23' AS NUMERIC); } {real|1.23} +do_execsql_test_regex sqlite-version-should-return-valid-output { + SELECT sqlite_version(); +} {\d+\.\d+\.\d+} + # TODO COMPAT: sqlite returns 9.22337203685478e+18, do we care...? # do_execsql_test cast-large-text-to-numeric { # SELECT typeof(CAST('9223372036854775808' AS NUMERIC)), CAST('9223372036854775808' AS NUMERIC); diff --git a/testing/tester.tcl b/testing/tester.tcl index 04a43c3eb..b8cbff17f 100644 --- a/testing/tester.tcl +++ b/testing/tester.tcl @@ -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]