Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
Add test
  • Loading branch information
obsoleszenz committed Apr 18, 2024
1 parent c96c870 commit b4776a3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions diesel_tests/tests/boxed_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,14 @@ fn can_box_query_with_boxable_expression() {
let expected = vec![find_user_by_name("Sean", connection)];
assert_eq!(Ok(expected), data);
}

#[test]
fn can_box_query_having_with_boxable_expression() {
let connection = &mut connection_with_sean_and_tess_in_users_table();

let expr: Box<dyn BoxableExpression<users::table, _, SqlType = _>> =
Box::new(count(users::id).eq(2)) as _;

use diesel::dsl::count;
let data: Vec<i64> = users::table.select(count(users::id)).group_by(users::id).having(expr).into_boxed().load(connection).expect("db error");
}

0 comments on commit b4776a3

Please sign in to comment.