Skip to content

Commit 7353cca

Browse files
authored
Fix spurious test failures with Swift 6 on Linux (#78)
Fix spurious test failures with Swift 6 on Linux by eliminating a redundant test and using the one that already accounts for the precision issue.
1 parent 0c6a711 commit 7353cca

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Tests/SQLiteNIOTests/SQLiteNIOTests.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,8 @@ final class SQLiteNIOTests: XCTestCase {
7070

7171
func testTimestampStorage() async throws {
7272
try await withOpenedConnection { conn in
73-
let date = Date()
74-
let rows = try await conn.query("SELECT ? as date", [date.sqliteData!])
75-
XCTAssertEqual(rows.first?.column("date"), .float(date.timeIntervalSince1970))
76-
XCTAssertEqual(rows.first?.column("date").flatMap(Date.init(sqliteData:))?.description, date.description)
77-
XCTAssertEqual(rows.first?.column("date").flatMap(Date.init(sqliteData:)), date)
78-
XCTAssertEqual(rows.first?.column("date").flatMap(Date.init(sqliteData:))?.timeIntervalSinceReferenceDate, date.timeIntervalSinceReferenceDate)
79-
}
80-
}
81-
82-
func testTimestampStorageRoundToMicroseconds() async throws {
83-
try await withOpenedConnection { conn in
84-
// Test value that when read back out of sqlite results in 7 decimal places that we need to round to microseconds
73+
// When the value is read back out of sqlite, it will have only microsecond precision, make sure we use a Date with
74+
// the same limit or else the test will fail.
8575
let date = Date(timeIntervalSinceReferenceDate: 689658914.293192)
8676
let rows = try await conn.query("SELECT ? as date", [date.sqliteData!])
8777
XCTAssertEqual(rows.first?.column("date"), .float(date.timeIntervalSince1970))

0 commit comments

Comments
 (0)