From d6c93fd2a8af99df9bc8dc362144e6f599c6030c Mon Sep 17 00:00:00 2001 From: Thomas BESSOU Date: Tue, 19 Nov 2024 18:06:08 +0100 Subject: [PATCH] Add failing test for array eq_any --- diesel_tests/tests/filter_operators.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/diesel_tests/tests/filter_operators.rs b/diesel_tests/tests/filter_operators.rs index f95bd172b2ca..b4d42a34f31e 100644 --- a/diesel_tests/tests/filter_operators.rs +++ b/diesel_tests/tests/filter_operators.rs @@ -264,6 +264,21 @@ fn filter_by_in() { ); } +#[test] +#[cfg(feature = "postgres")] +fn filter_array_by_in() { + use crate::schema::posts::dsl::*; + + let connection: &mut PgConnection = &mut connection(); + let tag_combinations_to_look_for: &[&[&str]] = &[&["foo"], &["foo", "bar"], &["baz"]]; + let result: Vec = posts + .filter(tags.eq_any(tag_combinations_to_look_for)) + .select(id) + .load(connection) + .unwrap(); + assert_eq!(result, &[] as &[i32]); +} + fn connection_with_3_users() -> TestConnection { let mut connection = connection_with_sean_and_tess_in_users_table(); diesel::sql_query("INSERT INTO users (id, name) VALUES (3, 'Jim')")