File tree 1 file changed +18
-0
lines changed 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 {
76
76
XCTAssertEqual ( rows. count, 1 )
77
77
XCTAssertEqual ( try rows. first? . decode ( String . self, context: . default) . contains ( " PostgreSQL " ) , true )
78
78
}
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
+ }
79
97
80
98
func testQueryVersion( ) {
81
99
var conn : PostgresConnection ?
You can’t perform that action at this time.
0 commit comments