Archived
1
0
Fork 0

chore: split tests for...

merge query with params function
This commit is contained in:
Dmitriy Pleshevskiy 2021-02-20 22:31:56 +03:00
parent a4d8218307
commit a5b3d33bef

View file

@ -42,17 +42,23 @@ mod tests {
use super::*; use super::*;
#[test] #[test]
fn merge_query_with_params_successfully() { fn replace_one_param_in_query() {
assert_eq!( assert_eq!(
merge_query_with_params("SELECT $1", &[&"foo"]), merge_query_with_params("SELECT $1", &[&"foo"]),
"SELECT 'foo'" "SELECT 'foo'"
); );
}
#[test]
fn replace_two_params_in_query() {
assert_eq!( assert_eq!(
merge_query_with_params("SELECT $1, $2", &[&"foo", &"bar"]), merge_query_with_params("SELECT $1, $2", &[&"foo", &"bar"]),
"SELECT 'foo', 'bar'" "SELECT 'foo', 'bar'"
); );
}
#[test]
fn replace_all_bonds_in_query_with_first_param() {
assert_eq!( assert_eq!(
merge_query_with_params("SELECT $1, $1", &[&"foo"]), merge_query_with_params("SELECT $1, $1", &[&"foo"]),
"SELECT 'foo', 'foo'" "SELECT 'foo', 'foo'"