From 8cf6969f8228fab247603583136c34f43ce3a8aa Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Mon, 4 Sep 2023 12:57:43 +0300 Subject: [PATCH] libsql/core: Improve named parameter tests --- crates/core/tests/integration_tests.rs | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/crates/core/tests/integration_tests.rs b/crates/core/tests/integration_tests.rs index 431c23fd7a..17dac4992d 100644 --- a/crates/core/tests/integration_tests.rs +++ b/crates/core/tests/integration_tests.rs @@ -158,6 +158,44 @@ fn prepare_and_query_named_params() { ":b": "Alice", }, ); + + check_insert( + &conn, + "INSERT INTO users (id, name) VALUES (@a, @b)", + vec![ + ("@a".to_string(), 2.into()), + ("@b".to_string(), "Alice".into()), + ] + .into(), + ); + + check_insert( + &conn, + "INSERT INTO users (id, name) VALUES (@a, @b)", + named_params! { + "@a": 2, + "@b": "Alice", + }, + ); + + check_insert( + &conn, + "INSERT INTO users (id, name) VALUES ($a, $b)", + vec![ + ("$a".to_string(), 2.into()), + ("$b".to_string(), "Alice".into()), + ] + .into(), + ); + + check_insert( + &conn, + "INSERT INTO users (id, name) VALUES ($a, $b)", + named_params! { + "$a": 2, + "$b": "Alice", + }, + ); } #[test]