File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,24 @@ final class PostgresNIOTests: XCTestCase {
7676 XCTAssertEqual ( rows. count, 1 )
7777 XCTAssertEqual ( try rows. first? . decode ( String . self, context: . default) . contains ( " PostgreSQL " ) , true )
7878 }
79+
80+ func testSimpleQueryWithQuotes( ) {
81+ var conn : PostgresConnection ?
82+ XCTAssertNoThrow ( conn = try PostgresConnection . test ( on: eventLoop) . wait ( ) )
83+ defer { XCTAssertNoThrow ( try conn? . close ( ) . wait ( ) ) }
84+
85+ var receivedNotifications : [ PostgresMessage . NotificationResponse ] = [ ]
86+ conn? . addListener ( channel: " default " ) { context, notification in
87+ receivedNotifications. append ( notification)
88+ }
89+ XCTAssertNoThrow ( _ = try conn? . simpleQuery ( " LISTEN \" default \" " ) . wait ( ) )
90+ XCTAssertNoThrow ( _ = try conn? . simpleQuery ( " NOTIFY \" default \" " ) . wait ( ) )
91+ // Notifications are asynchronous, so we should run at least one more query to make sure we'll have received the notification response by then
92+ XCTAssertNoThrow ( _ = try conn? . simpleQuery ( " SELECT 1 " ) . wait ( ) )
93+ XCTAssertEqual ( receivedNotifications. count, 1 )
94+ XCTAssertEqual ( receivedNotifications. first? . channel, " default " )
95+ XCTAssertEqual ( receivedNotifications. first? . payload, " " )
96+ }
7997
8098 func testQueryVersion( ) {
8199 var conn : PostgresConnection ?
You can’t perform that action at this time.
0 commit comments