@@ -540,6 +540,21 @@ class PostgreSQLConnectionTests: XCTestCase {
540540 print ( c)
541541 }
542542 }
543+
544+ func testUpsert( ) throws {
545+ let values : [ ( PostgreSQLUpsert . Identifier , PostgreSQLUpsert . Expression ) ] = [ ]
546+
547+ var upsert : PostgreSQLUpsert
548+
549+ upsert = PostgreSQLUpsert . upsert ( nil , values)
550+ XCTAssertEqual ( upsert. columns, [ PostgreSQLColumnIdentifier . column ( nil , . identifier( " id " ) ) ] )
551+
552+ upsert = PostgreSQLUpsert . upsert ( [ ] , values)
553+ XCTAssertEqual ( upsert. columns, [ PostgreSQLColumnIdentifier . column ( nil , . identifier( " id " ) ) ] )
554+
555+ upsert = PostgreSQLUpsert . upsert ( [ . column( nil , . identifier( " field " ) ) ] , values)
556+ XCTAssertEqual ( upsert. columns, [ PostgreSQLColumnIdentifier . column ( nil , . identifier( " field " ) ) ] )
557+ }
543558
544559 static var allTests = [
545560 ( " testBenchmark " , testBenchmark) ,
@@ -560,6 +575,7 @@ class PostgreSQLConnectionTests: XCTestCase {
560575 ( " testOrderBy " , testOrderBy) ,
561576 ( " testInvalidDate " , testInvalidDate) ,
562577 ( " testEmptyArray " , testEmptyArray) ,
578+ ( " testUpsert " , testUpsert) ,
563579 ]
564580}
565581
0 commit comments