From a5b3d33bef77c20d172b4d4453c7d35a91a30381 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 20 Feb 2021 22:31:56 +0300 Subject: [PATCH] chore: split tests for... merge query with params function --- migra-cli/src/database.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/migra-cli/src/database.rs b/migra-cli/src/database.rs index d79af1a..69f0cbf 100644 --- a/migra-cli/src/database.rs +++ b/migra-cli/src/database.rs @@ -42,17 +42,23 @@ mod tests { use super::*; #[test] - fn merge_query_with_params_successfully() { + fn replace_one_param_in_query() { assert_eq!( merge_query_with_params("SELECT $1", &[&"foo"]), "SELECT 'foo'" ); + } + #[test] + fn replace_two_params_in_query() { assert_eq!( merge_query_with_params("SELECT $1, $2", &[&"foo", &"bar"]), "SELECT 'foo', 'bar'" ); + } + #[test] + fn replace_all_bonds_in_query_with_first_param() { assert_eq!( merge_query_with_params("SELECT $1, $1", &[&"foo"]), "SELECT 'foo', 'foo'"