Skip to content

Commit

Permalink
Add failing test for array eq_any
Browse files Browse the repository at this point in the history
  • Loading branch information
Ten0 committed Nov 19, 2024
1 parent 5a2940e commit d6c93fd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions diesel_tests/tests/filter_operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32> = 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')")
Expand Down

0 comments on commit d6c93fd

Please sign in to comment.