From 4464cb34ed24ce254c41c242b905b028c0f3bcc5 Mon Sep 17 00:00:00 2001 From: Jocelyne Date: Mon, 27 Jan 2025 12:13:44 +0100 Subject: [PATCH] test: Add tests for `eqSubQuery` and `notEqSubQuery` operators --- .../sql/tests/shared/dml/SelectTests.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/dml/SelectTests.kt b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/dml/SelectTests.kt index c37dea3c8c..93caf16546 100644 --- a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/dml/SelectTests.kt +++ b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/dml/SelectTests.kt @@ -278,6 +278,26 @@ class SelectTests : DatabaseTestsBase() { } } + @Test + fun testEqSubQuery() { + withCitiesAndUsers { _, _, userData -> + val query = userData.selectAll().where { + userData.value eqSubQuery userData.select(userData.value).where { userData.user_id eq "eugene" } + } + assertEquals(2, query.count()) + } + } + + @Test + fun testNotEqSubQuery() { + withCitiesAndUsers { _, _, userData -> + val query = userData.selectAll().where { + userData.value notEqSubQuery userData.select(userData.value).where { userData.user_id eq "sergey" } + } + assertEquals(3, query.count()) + } + } + @Test fun testLessSubQuery() { withCitiesAndUsers { _, _, userData ->