From fa0503f0ce35b32844da449a3aee8f0458595999 Mon Sep 17 00:00:00 2001 From: Krishna Vishal Date: Sun, 19 Jan 2025 04:58:05 +0530 Subject: [PATCH] 1. Changes to extension.py 2. chore: cargo fmt --- core/function.rs | 2 +- core/translate/select.rs | 2 +- core/vdbe/mod.rs | 2 +- testing/extensions.py | 16 ++++++++++------ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/core/function.rs b/core/function.rs index 674ff57be..79065ab39 100644 --- a/core/function.rs +++ b/core/function.rs @@ -553,4 +553,4 @@ impl Func { _ => crate::bail_parse_error!("no such function: {}", name), } } -} \ No newline at end of file +} diff --git a/core/translate/select.rs b/core/translate/select.rs index d2c2a8f27..8569f8135 100644 --- a/core/translate/select.rs +++ b/core/translate/select.rs @@ -335,4 +335,4 @@ pub fn prepare_select_plan( } _ => todo!(), } -} \ No newline at end of file +} diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs index f6940ddd9..291c1b427 100644 --- a/core/vdbe/mod.rs +++ b/core/vdbe/mod.rs @@ -4215,4 +4215,4 @@ mod tests { expected_str ); } -} \ No newline at end of file +} diff --git a/testing/extensions.py b/testing/extensions.py index 61255e804..9dcd27846 100755 --- a/testing/extensions.py +++ b/testing/extensions.py @@ -115,8 +115,12 @@ def validate_string_uuid(result): return len(result) == 36 and result.count("-") == 4 +def returns_error(result): + return "error: no such function: " in result + + def returns_null(result): - return result == "" or result == b"\n" or result == b"" + return result == "" or result == "\n" def assert_now_unixtime(result): @@ -135,10 +139,10 @@ def test_uuid(pipe): run_test( pipe, "SELECT uuid4();", - returns_null, + returns_error, "uuid functions return null when ext not loaded", ) - run_test(pipe, "SELECT uuid4_str();", returns_null) + run_test(pipe, "SELECT uuid4_str();", returns_error) run_test( pipe, f".load {extension_path}", @@ -178,7 +182,7 @@ def test_regexp(pipe): extension_path = "./target/debug/liblimbo_regexp.so" # before extension loads, assert no function - run_test(pipe, "SELECT regexp('a.c', 'abc');", returns_null) + run_test(pipe, "SELECT regexp('a.c', 'abc');", returns_error) run_test(pipe, f".load {extension_path}", returns_null) print(f"Extension {extension_path} loaded successfully.") run_test(pipe, "SELECT regexp('a.c', 'abc');", validate_true) @@ -225,7 +229,7 @@ def test_aggregates(pipe): run_test( pipe, "SELECT median(1);", - returns_null, + returns_error, "median agg function returns null when ext not loaded", ) run_test( @@ -282,4 +286,4 @@ def main(): if __name__ == "__main__": - main() + main() \ No newline at end of file