[BREAKING] tvOS 13+

This commit is contained in:
Gwendal Roué committed 2024-09-21 13:57:35 +02:00
1 parent 8c40592955
commit e4a4735494
68 files changed
+273 -284

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '13.0'
s.osx.deployment_target = '10.13'
s.watchos.deployment_target = '7.0'
s.tvos.deployment_target = '12.0'
s.tvos.deployment_target = '13.0'
s.default_subspec = 'standard'
s.subspec 'standard' do |ss|
+1 -1
View File
@@ -492,7 +492,7 @@ extension Database {
// and throws the user-provided cancelled commit error.
try observationBroker?.statementDidFail(statement)
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
switch ResultCode(rawValue: resultCode) {
case .SQLITE_INTERRUPT, .SQLITE_ABORT:
if suspensionMutex.load().isCancelled {
+3 -3
View File
@@ -1199,7 +1199,7 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
/// will throw `CancellationError`, until `uncancel()` is called.
///
/// This method can be called from any thread.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func cancel() {
let needsInterrupt = suspensionMutex.withLock { suspension in
if suspension.isCancelled {
@@ -1216,7 +1216,7 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
}
/// Undo `cancel()`.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func uncancel() {
suspensionMutex.withLock {
$0.isCancelled = false
@@ -1320,7 +1320,7 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
break
case .cancel:
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
throw CancellationError()
} else {
// GRDB bug: cancellation is a Swift concurrency feature
+4 -4
View File
@@ -351,7 +351,7 @@ extension DatabasePool: DatabaseReader {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func read<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -436,7 +436,7 @@ extension DatabasePool: DatabaseReader {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func unsafeRead<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -803,7 +803,7 @@ extension DatabasePool: DatabaseWriter {
try writer.sync(updates)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func writeWithoutTransaction<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -820,7 +820,7 @@ extension DatabasePool: DatabaseWriter {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func barrierWriteWithoutTransaction<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T {
+1 -1
View File
@@ -1,5 +1,5 @@
#if canImport(Combine)
/// A namespace for database Combine publishers.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public enum DatabasePublishers { }
#endif
+4 -4
View File
@@ -233,7 +233,7 @@ extension DatabaseQueue: DatabaseReader {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func read<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -272,7 +272,7 @@ extension DatabaseQueue: DatabaseReader {
try writer.sync(value)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func unsafeRead<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -386,7 +386,7 @@ extension DatabaseQueue: DatabaseWriter {
try writer.sync(updates)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func writeWithoutTransaction<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -398,7 +398,7 @@ extension DatabaseQueue: DatabaseWriter {
try writer.sync(updates)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func barrierWriteWithoutTransaction<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T {
+7 -7
View File
@@ -216,7 +216,7 @@ public protocol DatabaseReader: AnyObject, Sendable {
/// - throws: Any ``DatabaseError`` that happens while establishing the
/// database access, or the error thrown by `value`, or
/// `CancellationError` if the task is cancelled.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func read<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T
@@ -323,7 +323,7 @@ public protocol DatabaseReader: AnyObject, Sendable {
/// - throws: Any ``DatabaseError`` that happens while establishing the
/// database access, or the error thrown by `value`, or
/// `CancellationError` if the task is cancelled.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func unsafeRead<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T
@@ -535,7 +535,7 @@ extension DatabaseReader {
///
/// - parameter scheduler: A Combine Scheduler.
/// - parameter value: A closure which accesses the database.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func readPublisher<Output>(
receiveOn scheduler: some Combine.Scheduler = DispatchQueue.main,
value: @escaping @Sendable (Database) throws -> Output
@@ -550,7 +550,7 @@ extension DatabaseReader {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension DatabasePublishers {
/// A publisher that reads from the database.
///
@@ -569,7 +569,7 @@ extension DatabasePublishers {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Publisher where Failure == Error {
fileprivate func eraseToReadPublisher() -> DatabasePublishers.Read<Output> {
.init(upstream: eraseToAnyPublisher())
@@ -660,7 +660,7 @@ extension AnyDatabaseReader: DatabaseReader {
try base.read(value)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func read<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -678,7 +678,7 @@ extension AnyDatabaseReader: DatabaseReader {
try base.unsafeRead(value)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func unsafeRead<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
+3 -3
View File
@@ -128,7 +128,7 @@ extension DatabaseRegionObservation {
}
#if canImport(Combine)
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension DatabaseRegionObservation {
// MARK: - Publishing Impactful Transactions
@@ -140,7 +140,7 @@ extension DatabaseRegionObservation {
///
/// Do not reschedule the publisher with `receive(on:options:)` or any
/// `Publisher` method that schedules publisher elements.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func publisher(in writer: some DatabaseWriter) -> DatabasePublishers.DatabaseRegion {
DatabasePublishers.DatabaseRegion(self, in: writer)
}
@@ -186,7 +186,7 @@ private class DatabaseRegionObserver: TransactionObserver {
}
#if canImport(Combine)
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension DatabasePublishers {
/// A publisher that tracks transactions that modify a database region.
///
+2 -2
View File
@@ -151,7 +151,7 @@ extension DatabaseSnapshot: DatabaseSnapshotReader {
try reader.sync(block)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func read<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -173,7 +173,7 @@ extension DatabaseSnapshot: DatabaseSnapshotReader {
// We can't provide this as a default implementation in
// `DatabaseSnapshotReader`, because of
// <https://github.com/apple/swift/issues/74469>.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func unsafeRead<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
+2 -2
View File
@@ -293,7 +293,7 @@ extension DatabaseSnapshotPool: DatabaseSnapshotReader {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func read<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -353,7 +353,7 @@ extension DatabaseSnapshotPool: DatabaseSnapshotReader {
// We can't provide this as a default implementation in
// `DatabaseSnapshotReader`, because of
// <https://github.com/apple/swift/issues/74469>.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func unsafeRead<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
+15 -15
View File
@@ -131,7 +131,7 @@ public protocol DatabaseWriter: DatabaseReader {
/// - throws: Any ``DatabaseError`` that happens while establishing the
/// database access, or the error thrown by `updates`, or
/// `CancellationError` if the task is cancelled.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func writeWithoutTransaction<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T
@@ -217,7 +217,7 @@ public protocol DatabaseWriter: DatabaseReader {
/// - throws: Any ``DatabaseError`` that happens while establishing the
/// database access, or the error thrown by `updates`, or
/// `CancellationError` if the task is cancelled.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func barrierWriteWithoutTransaction<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T
@@ -649,7 +649,7 @@ extension DatabaseWriter {
/// - throws: Any ``DatabaseError`` that happens while establishing the
/// database access, or the error thrown by `updates`, or
/// `CancellationError` if the task is cancelled.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func write<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -666,7 +666,7 @@ extension DatabaseWriter {
/// Erase the database: delete all content, drop all tables, etc.
///
/// - note: [**🔥 EXPERIMENTAL**](https://github.com/groue/GRDB.swift/blob/master/README.md#what-are-experimental-features)
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func erase() async throws {
try await writeWithoutTransaction { try $0.erase() }
}
@@ -677,7 +677,7 @@ extension DatabaseWriter {
/// - note: [**🔥 EXPERIMENTAL**](https://github.com/groue/GRDB.swift/blob/master/README.md#what-are-experimental-features)
///
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html>
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func vacuum() async throws {
try await writeWithoutTransaction { try $0.execute(sql: "VACUUM") }
}
@@ -694,7 +694,7 @@ extension DatabaseWriter {
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html#vacuuminto>
///
/// - Parameter filePath: file path for new database
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func vacuum(into filePath: String) async throws {
try await writeWithoutTransaction {
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
@@ -709,7 +709,7 @@ extension DatabaseWriter {
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html#vacuuminto>
///
/// - Parameter filePath: file path for new database
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func vacuum(into filePath: String) async throws {
try await writeWithoutTransaction {
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
@@ -754,7 +754,7 @@ extension DatabaseWriter {
///
/// - parameter scheduler: A Combine Scheduler.
/// - parameter updates: A closure which accesses the database.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func writePublisher<Output>(
receiveOn scheduler: some Combine.Scheduler = DispatchQueue.main,
updates: @escaping @Sendable (Database) throws -> Output
@@ -818,7 +818,7 @@ extension DatabaseWriter {
/// - parameter scheduler: A Combine Scheduler.
/// - parameter updates: A closure which writes in the database.
/// - parameter value: A closure which reads from the database.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func writePublisher<T: Sendable, Output>(
receiveOn scheduler: some Combine.Scheduler = DispatchQueue.main,
updates: @escaping @Sendable (Database) throws -> T,
@@ -848,7 +848,7 @@ extension DatabaseWriter {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension DatabasePublishers {
/// A publisher that writes into the database.
///
@@ -867,7 +867,7 @@ extension DatabasePublishers {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Publisher where Failure == Error {
fileprivate func eraseToWritePublisher() -> DatabasePublishers.Write<Output> {
.init(upstream: self.eraseToAnyPublisher())
@@ -911,7 +911,7 @@ extension AnyDatabaseWriter: DatabaseReader {
try base.read(value)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func read<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -929,7 +929,7 @@ extension AnyDatabaseWriter: DatabaseReader {
try base.unsafeRead(value)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func unsafeRead<T: Sendable>(
_ value: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -964,7 +964,7 @@ extension AnyDatabaseWriter: DatabaseWriter {
try base.writeWithoutTransaction(updates)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func writeWithoutTransaction<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -976,7 +976,7 @@ extension AnyDatabaseWriter: DatabaseWriter {
try base.barrierWriteWithoutTransaction(updates)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func barrierWriteWithoutTransaction<T: Sendable>(
_ updates: @escaping @Sendable (Database) throws -> T
) async throws -> T {
+4 -4
View File
@@ -244,7 +244,7 @@ final class SerializedDatabase {
}
/// Asynchrously executes the block.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func execute<T: Sendable>(
_ block: @escaping @Sendable (Database) throws -> T
) async throws -> T {
@@ -309,7 +309,7 @@ extension SerializedDatabase: @unchecked Sendable { }
// MARK: - Task Cancellation Support
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
enum DatabaseAccessCancellationState: @unchecked Sendable {
// @unchecked Sendable because database is only accessed from its
// dispatch queue.
@@ -319,7 +319,7 @@ enum DatabaseAccessCancellationState: @unchecked Sendable {
case expired
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
typealias CancellableDatabaseAccess = Mutex<DatabaseAccessCancellationState>
/// Supports Task cancellation in async database accesses.
@@ -341,7 +341,7 @@ typealias CancellableDatabaseAccess = Mutex<DatabaseAccessCancellationState>
/// }
/// }
/// ```
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension CancellableDatabaseAccess: DatabaseCancellable {
convenience init() {
self.init(.notConnected)
+1 -1
View File
@@ -52,7 +52,7 @@ public struct JSONDumpFormat: Sendable {
public static var defaultEncoder: JSONEncoder {
// This encoder MUST NOT CHANGE, because some people rely on this format.
let encoder = JSONEncoder()
if #available(macOS 10.15, tvOS 13.0, *) {
if #available(macOS 10.15.0, *) {
encoder.outputFormatting = .withoutEscapingSlashes
}
encoder.nonConformingFloatEncodingStrategy = .convertToString(
+3 -3
View File
@@ -119,7 +119,7 @@ extension PersistableRecord {
public func performSave(_ db: Database) throws { preconditionFailure() }
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension QueryInterfaceRequest where RowDecoder: Identifiable, RowDecoder.ID: DatabaseValueConvertible {
@available(*, unavailable, message: "selectID() has been removed. You may use selectPrimaryKey(as:) instead.")
public func selectID() -> QueryInterfaceRequest<RowDecoder.ID> { preconditionFailure() }
@@ -144,13 +144,13 @@ extension SelectionRequest {
@available(*, unavailable, renamed: "SQLExpression.AssociativeBinaryOperator")
public typealias SQLAssociativeBinaryOperator = SQLExpression.AssociativeBinaryOperator
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Table where RowDecoder: Identifiable, RowDecoder.ID: DatabaseValueConvertible {
@available(*, unavailable, message: "selectID() has been removed. You may use selectPrimaryKey(as:) instead.")
public func selectID() -> QueryInterfaceRequest<RowDecoder.ID> { preconditionFailure() }
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
@available(*, unavailable, message: "selectID() has been removed. You may use selectPrimaryKey(as:) instead.")
public static func selectID() -> QueryInterfaceRequest<ID> { preconditionFailure() }
+2 -2
View File
@@ -496,7 +496,7 @@ extension DatabaseMigrator {
/// - parameter writer: A DatabaseWriter.
/// where migrations should apply.
/// - parameter scheduler: A Combine Scheduler.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func migratePublisher(
_ writer: some DatabaseWriter,
receiveOn scheduler: some Combine.Scheduler = DispatchQueue.main)
@@ -514,7 +514,7 @@ extension DatabaseMigrator {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension DatabasePublishers {
/// A publisher that migrates a database.
///
@@ -646,7 +646,7 @@ extension QueryInterfaceRequest {
/// - parameter db: A database connection.
/// - returns: A set of deleted ids.
/// - throws: A ``DatabaseError`` whenever an SQLite error occurs.
@available(macOS 10.15, tvOS 13, *) // Identifiable
@available(macOS 10.15, *) // Identifiable
public func deleteAndFetchIds(_ db: Database)
throws -> Set<RowDecoder.ID>
where RowDecoder: TableRecord & Identifiable,
@@ -631,7 +631,7 @@ extension TableRequest where Self: FilteredRequest, Self: TypedRequest {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension TableRequest
where Self: FilteredRequest,
Self: TypedRequest,
+3 -3
View File
@@ -722,7 +722,7 @@ extension Table {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Table where RowDecoder: Identifiable, RowDecoder.ID: DatabaseValueConvertible {
/// Returns a request filtered by primary key.
///
@@ -1545,7 +1545,7 @@ extension Table {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Table
where RowDecoder: Identifiable,
RowDecoder.ID: DatabaseValueConvertible
@@ -1686,7 +1686,7 @@ extension Table {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Table
where RowDecoder: Identifiable,
RowDecoder.ID: DatabaseValueConvertible
@@ -129,7 +129,6 @@ public final class TableAlteration {
///
/// - parameter name: the old name of the column.
/// - parameter newName: the new name of the column.
@available(tvOS 13, *) // SQLite 3.25+
public func rename(column name: String, to newName: String) {
_rename(column: name, to: newName)
}
@@ -604,7 +604,7 @@ extension TableRecord {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
/// Returns a request filtered by primary key.
///
@@ -216,7 +216,7 @@ extension FetchableRecord where Self: TableRecord {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension FetchableRecord where Self: TableRecord & Identifiable, ID: DatabaseValueConvertible {
// MARK: Fetching by Single-Column Primary Key
@@ -358,7 +358,7 @@ extension FetchableRecord where Self: TableRecord & Hashable {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension FetchableRecord where Self: TableRecord & Hashable & Identifiable, ID: DatabaseValueConvertible {
/// Returns a set of records identified by their primary keys.
///
+3 -3
View File
@@ -319,7 +319,7 @@ extension TableRecord {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
/// Returns whether a record exists for this primary key.
///
@@ -454,7 +454,7 @@ extension TableRecord {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
/// Deletes records identified by their primary keys, and returns the number
/// of deleted records.
@@ -774,7 +774,7 @@ extension TableRecord where Self: EncodableRecord {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension TableRecord where Self: Identifiable, ID: DatabaseValueConvertible {
/// Returns an error for a record that does not exist in the database.
///
+2 -2
View File
@@ -17,7 +17,7 @@ import Foundation
///
/// OnDemandFuture also adds Sendable requirements that avoid
/// compiler warnings.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
struct OnDemandFuture<Output, Failure: Error>: Publisher {
typealias Promise = @Sendable (Result<Output, Failure>) -> Void
typealias Output = Output
@@ -36,7 +36,7 @@ struct OnDemandFuture<Output, Failure: Error>: Publisher {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
private class OnDemandFutureSubscription<Downstream: Subscriber>: Subscription, @unchecked Sendable {
// @unchecked because `state` is protected with `lock`.
typealias Promise = @Sendable (Result<Downstream.Input, Downstream.Failure>) -> Void
+3 -3
View File
@@ -11,7 +11,7 @@ import Foundation
/// This scheduling guarantee is used by GRDB in order to be able
/// to make promises on the scheduling of database values without surprising
/// the users as in <https://forums.swift.org/t/28631>.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
struct ReceiveValuesOn<Upstream: Publisher, Context: Scheduler>: Publisher {
typealias Output = Upstream.Output
typealias Failure = Upstream.Failure
@@ -30,7 +30,7 @@ struct ReceiveValuesOn<Upstream: Publisher, Context: Scheduler>: Publisher {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
private class ReceiveValuesOnSubscription<Upstream, Context, Downstream>: Subscription, Subscriber
where
Upstream: Publisher,
@@ -211,7 +211,7 @@ where
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Publisher {
/// Specifies the scheduler on which to receive values from the publisher
///
@@ -292,7 +292,7 @@ public final class SharedValueObservation<Element: Sendable>: @unchecked Sendabl
/// print("fresh players: \(players)")
/// }
/// ```
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func publisher() -> DatabasePublishers.Value<Element> {
DatabasePublishers.Value { onError, onChange in
self.start(onError: onError, onChange: onChange)
@@ -369,7 +369,7 @@ extension SharedValueObservation {
/// print("Fresh players: \(players)")
/// }
/// ```
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func values(bufferingPolicy: AsyncValueObservation<Element>.BufferingPolicy = .unbounded)
-> AsyncValueObservation<Element>
{
+5 -5
View File
@@ -179,7 +179,7 @@ extension ValueObservation: Refinable {
/// - parameter onChange: The closure to execute on receipt of a
/// fresh value.
/// - returns: A DatabaseCancellable that can stop the observation.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
@preconcurrency @MainActor public func start(
in reader: some DatabaseReader,
scheduling scheduler: some ValueObservationMainActorScheduler = .mainActor,
@@ -350,7 +350,7 @@ extension ValueObservation {
/// fresh values are dispatched on the cooperative thread pool.
/// - parameter bufferingPolicy: see the documntation
/// of `AsyncThrowingStream`.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func values(
in reader: some DatabaseReader,
scheduling scheduler: some ValueObservationScheduler = .task,
@@ -386,7 +386,7 @@ extension ValueObservation {
///
/// You build an `AsyncValueObservation` from ``ValueObservation`` or
/// ``SharedValueObservation``.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public struct AsyncValueObservation<Element: Sendable>: AsyncSequence {
public typealias BufferingPolicy = AsyncThrowingStream<Element, Error>.Continuation.BufferingPolicy
public typealias AsyncIterator = Iterator
@@ -488,7 +488,7 @@ extension ValueObservation {
/// - parameter scheduler: A ValueObservationScheduler. By default, fresh
/// values are dispatched asynchronously on the main dispatch queue.
/// - returns: A Combine publisher
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func publisher(
in reader: some DatabaseReader,
scheduling scheduler: some ValueObservationScheduler = .async(onQueue: .main))
@@ -505,7 +505,7 @@ extension ValueObservation {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension DatabasePublishers {
/// A publisher that publishes the values of a ``ValueObservation``.
///
@@ -182,7 +182,7 @@ extension ValueObservationMainActorScheduler where Self == ImmediateValueObserva
// MARK: - TaskValueObservationScheduler
/// A scheduler that notifies all values on the cooperative thread pool.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public final class TaskValueObservationScheduler: ValueObservationScheduler {
typealias Action = @Sendable () -> Void
let continuation: AsyncStream<Action>.Continuation
@@ -212,7 +212,7 @@ public final class TaskValueObservationScheduler: ValueObservationScheduler {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension ValueObservationScheduler where Self == TaskValueObservationScheduler {
/// A scheduler that notifies all values from a new `Task`.
public static var task: TaskValueObservationScheduler {
@@ -229,7 +229,7 @@ extension ValueObservationScheduler where Self == TaskValueObservationScheduler
// MARK: - DelayedMainActorValueObservationScheduler
/// A scheduler that notifies all values on the cooperative thread pool.
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public final class DelayedMainActorValueObservationScheduler: ValueObservationMainActorScheduler {
public func immediateInitialValue() -> Bool {
false
@@ -240,7 +240,7 @@ public final class DelayedMainActorValueObservationScheduler: ValueObservationMa
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension ValueObservationScheduler where Self == DelayedMainActorValueObservationScheduler {
/// A scheduler that notifies all values on the main actor.
public static var mainActor: DelayedMainActorValueObservationScheduler {
+1 -1
View File
@@ -38,7 +38,7 @@ let package = Package(
platforms: [
.iOS(.v13),
.macOS(.v10_13),
.tvOS(.v12),
.tvOS(.v13),
.watchOS(.v7),
],
products: [
+1 -1
View File
@@ -17,7 +17,7 @@
**Latest release**: September 7, 2024 • [version 6.29.3](https://github.com/groue/GRDB.swift/tree/v6.29.3) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 5 to GRDB 6](Documentation/GRDB6MigrationGuide.md)
**Requirements**: iOS 13.0+ / macOS 10.13+ / tvOS 12.0+ / watchOS 7.0+ &bull; SQLite 3.19.3+ &bull; Swift 6+ / Xcode 16+
**Requirements**: iOS 13.0+ / macOS 10.13+ / tvOS 13.0+ / watchOS 7.0+ &bull; SQLite 3.19.3+ &bull; Swift 6+ / Xcode 16+
**Contact**:
+1 -1
View File
@@ -1,6 +1,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 13.0
MACOSX_DEPLOYMENT_TARGET = 10.13
TVOS_DEPLOYMENT_TARGET = 12.0
TVOS_DEPLOYMENT_TARGET = 13.0
WATCHOS_DEPLOYMENT_TARGET = 7.0
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
OTHER_SWIFT_FLAGS = $(inherited) -enable-upcoming-feature GlobalActorIsolatedTypesUsability
+1 -1
View File
@@ -1,6 +1,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 13.0
MACOSX_DEPLOYMENT_TARGET = 10.13
TVOS_DEPLOYMENT_TARGET = 12.0
TVOS_DEPLOYMENT_TARGET = 13.0
WATCHOS_DEPLOYMENT_TARGET = 7.0
OTHER_SWIFT_FLAGS = $(inherited) -D SQLITE_ENABLE_FTS5
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES
@@ -1,7 +1,7 @@
#if canImport(Combine)
import XCTest
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// A publisher expectation which waits for the timeout to expire, or
/// the recorded publisher to complete.
@@ -17,7 +17,7 @@ import XCTest
// try wait(for: recorder.finished.inverted, timeout: 1)
// }
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// A publisher expectation which waits for the recorded publisher
/// to complete.
@@ -1,7 +1,7 @@
#if canImport(Combine)
import XCTest
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// A publisher expectation that fails if the base expectation is fulfilled.
///
@@ -1,7 +1,7 @@
#if canImport(Combine)
import XCTest
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// A publisher expectation that transforms the value of a base expectation.
///
@@ -20,7 +20,7 @@ extension PublisherExpectations {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectation {
/// Returns a publisher expectation that transforms the value of the
/// base expectation.
@@ -1,7 +1,7 @@
#if canImport(Combine)
import XCTest
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// A publisher expectation which waits for the recorded publisher to emit
/// `count` elements, or to complete.
@@ -1,7 +1,7 @@
#if canImport(Combine)
import XCTest
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// A publisher expectation which waits for the recorded publisher to emit
/// one element, or to complete.
@@ -1,7 +1,7 @@
#if canImport(Combine)
import XCTest
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// A publisher expectation which waits for the recorded publisher to emit
/// `maxLength` elements, or to complete.
@@ -2,7 +2,7 @@
import Combine
import XCTest
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// A publisher expectation which waits for the recorded publisher
/// to complete.
+4 -4
View File
@@ -13,7 +13,7 @@ import XCTest
///
/// let elements = try wait(for: recorder.elements, timeout: 1)
/// XCTAssertEqual(elements, ["foo", "bar", "baz"])
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public class Recorder<Input, Failure: Error>: Subscriber {
public typealias Input = Input
public typealias Failure = Failure
@@ -287,7 +287,7 @@ public class Recorder<Input, Failure: Error>: Subscriber {
// MARK: - Publisher Expectations
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension PublisherExpectations {
/// The type of the publisher expectation returned by `Recorder.completion`.
public typealias Completion<Input, Failure: Error> = Map<Recording<Input, Failure>, Subscribers.Completion<Failure>>
@@ -302,7 +302,7 @@ extension PublisherExpectations {
public typealias Single<Input, Failure: Error> = Map<Elements<Input, Failure>, Input>
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Recorder {
/// Returns a publisher expectation which waits for the timeout to expire,
/// or the recorded publisher to complete.
@@ -584,7 +584,7 @@ extension Recorder {
// MARK: - Publisher + Recorder
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Publisher {
/// Returns a subscribed Recorder.
///
@@ -22,7 +22,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
// MARK: -
func testReadPublisher() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -128,7 +128,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
// frame #71: 0x00007fff72311cc9 libdyld.dylib`start + 1
// frame #72: 0x00007fff72311cc9 libdyld.dylib`start + 1
func testReadPublisherError() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -157,7 +157,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
// MARK: -
func testReadPublisherIsAsynchronous() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -197,7 +197,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
// MARK: -
func testReadPublisherDefaultScheduler() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -237,7 +237,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
// MARK: -
func testReadPublisherCustomScheduler() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -278,7 +278,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
// MARK: -
func testReadPublisherIsReadonly() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -20,7 +20,7 @@ private struct Player: Codable, FetchableRecord, PersistableRecord {
class DatabaseRegionObservationPublisherTests : XCTestCase {
func testChangesNotifications() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -61,7 +61,7 @@ class DatabaseRegionObservationPublisherTests : XCTestCase {
// TODO: do the same, but asynchronously. If this is too hard, update the
// public API so that users can easily do it.
func testPrependInitialDatabaseSync() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -22,7 +22,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// MARK: -
func testWritePublisher() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -49,7 +49,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// MARK: -
func testWritePublisherValue() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -76,7 +76,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// MARK: -
func testWritePublisherError() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -99,7 +99,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
}
func testWritePublisherErrorRollbacksTransaction() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -132,7 +132,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// MARK: -
func testWritePublisherIsAsynchronous() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -168,7 +168,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// MARK: -
func testWritePublisherDefaultScheduler() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -206,7 +206,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// MARK: -
func testWritePublisherCustomScheduler() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -247,7 +247,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// TODO: Fix flaky test with both pool and on-disk queue:
// - Expectation timeout
func testWriteThenReadPublisher() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -274,7 +274,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// MARK: -
func testWriteThenReadPublisherIsReadonly() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -299,7 +299,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// MARK: -
func testWriteThenReadPublisherWriteError() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -322,7 +322,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
}
func testWriteThenReadPublisherWriteErrorRollbacksTransaction() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -359,7 +359,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// TODO: Fix flaky test with both pool and on-disk queue:
// - Expectation timeout
func testWriteThenReadPublisherReadError() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -386,7 +386,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
// Regression test against deadlocks created by concurrent completion
// and cancellations triggered by .switchToLatest().prefix(1)
func testDeadlockPrevention() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
+3 -3
View File
@@ -51,7 +51,7 @@ final class Test<Context> {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
final class AsyncTest<Context> {
// Raise the repeatCount in order to help spotting flaky tests.
private let repeatCount: Int
@@ -100,7 +100,7 @@ final class AsyncTest<Context> {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func assertNoFailure<Failure>(
_ completion: Subscribers.Completion<Failure>,
file: StaticString = #file,
@@ -111,7 +111,7 @@ public func assertNoFailure<Failure>(
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public func assertFailure<Failure, ExpectedFailure>(
_ completion: Subscribers.Completion<Failure>,
file: StaticString = #file,
@@ -22,7 +22,7 @@ class ValueObservationPublisherTests : XCTestCase {
// MARK: - Default Scheduler
func testDefaultSchedulerChangesNotifications() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -64,7 +64,7 @@ class ValueObservationPublisherTests : XCTestCase {
}
func testDefaultSchedulerFirstValueIsEmittedAsynchronously() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -97,7 +97,7 @@ class ValueObservationPublisherTests : XCTestCase {
}
func testDefaultSchedulerError() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -123,7 +123,7 @@ class ValueObservationPublisherTests : XCTestCase {
// MARK: - Immediate Scheduler
func testImmediateSchedulerChangesNotifications() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -165,7 +165,7 @@ class ValueObservationPublisherTests : XCTestCase {
}
func testImmediateSchedulerEmitsFirstValueSynchronously() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -201,7 +201,7 @@ class ValueObservationPublisherTests : XCTestCase {
}
func testImmediateSchedulerError() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -226,7 +226,7 @@ class ValueObservationPublisherTests : XCTestCase {
// MARK: - Demand
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
private class DemandSubscriber<Input, Failure: Error>: Subscriber {
private var subscription: Subscription?
let subject = PassthroughSubject<Input, Failure>()
@@ -257,7 +257,7 @@ class ValueObservationPublisherTests : XCTestCase {
}
func testDemandNoneReceivesNoElement() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -292,7 +292,7 @@ class ValueObservationPublisherTests : XCTestCase {
}
func testDemandOneReceivesOneElement() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -330,7 +330,7 @@ class ValueObservationPublisherTests : XCTestCase {
}
func testDemandOneDoesNotReceiveTwoElements() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -372,7 +372,7 @@ class ValueObservationPublisherTests : XCTestCase {
}
func testDemandTwoReceivesTwoElements() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -418,7 +418,7 @@ class ValueObservationPublisherTests : XCTestCase {
/// Regression test for https://github.com/groue/GRDB.swift/issues/1194
func testIssue1194() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
+1 -1
View File
@@ -43,7 +43,7 @@ import Foundation
///
/// - ``wait()``
/// - ``waitUnlessCancelled()``
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
public final class AsyncSemaphore: @unchecked Sendable {
/// `Suspension` is the state of a task waiting for a signal.
///
@@ -25,7 +25,7 @@ private struct RecordWithData<Strategy: StrategyProvider>: EncodableRecord, Enco
var data: Data
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension RecordWithData: Identifiable {
var id: Data { data }
}
@@ -37,7 +37,7 @@ private struct RecordWithOptionalData<Strategy: StrategyProvider>: EncodableReco
var data: Data?
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension RecordWithOptionalData: Identifiable {
var id: Data? { data }
}
@@ -154,7 +154,7 @@ extension DatabaseDataEncodingStrategyTests {
}
func testFilterID() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Identifiable not available")
}
@@ -234,7 +234,7 @@ extension DatabaseDataEncodingStrategyTests {
}
func testDeleteID() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Identifiable not available")
}
@@ -52,7 +52,7 @@ private struct RecordWithDate<Strategy: StrategyProvider>: EncodableRecord, Enco
var date: Date
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension RecordWithDate: Identifiable {
var id: Date { date }
}
@@ -64,7 +64,7 @@ private struct RecordWithOptionalDate<Strategy: StrategyProvider>: EncodableReco
var date: Date?
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension RecordWithOptionalDate: Identifiable {
var id: Date? { date }
}
@@ -264,7 +264,7 @@ extension DatabaseDateEncodingStrategyTests {
}
func testFilterID() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Identifiable not available")
}
@@ -344,7 +344,7 @@ extension DatabaseDateEncodingStrategyTests {
}
func testDeleteID() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Identifiable not available")
}
+1 -1
View File
@@ -238,7 +238,7 @@ final class DatabaseDumpTests: GRDBTestCase {
// MARK: - JSON
func test_json_value_formatting() throws {
guard #available(macOS 10.15, tvOS 13.0, *) else {
guard #available(macOS 10.15.0, *) else {
throw XCTSkip("Skip because this test relies on JSONEncoder.OutputFormatting.withoutEscapingSlashes")
}
+6 -6
View File
@@ -41,7 +41,7 @@ class DatabaseMigratorTests : GRDBTestCase {
}
func testEmptyMigratorPublisher() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -153,7 +153,7 @@ class DatabaseMigratorTests : GRDBTestCase {
}
func testNonEmptyMigratorPublisher() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -209,7 +209,7 @@ class DatabaseMigratorTests : GRDBTestCase {
}
func testEmptyMigratorPublisherIsAsynchronous() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -235,7 +235,7 @@ class DatabaseMigratorTests : GRDBTestCase {
}
func testNonEmptyMigratorPublisherIsAsynchronous() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -262,7 +262,7 @@ class DatabaseMigratorTests : GRDBTestCase {
}
func testMigratorPublisherDefaultScheduler() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -291,7 +291,7 @@ class DatabaseMigratorTests : GRDBTestCase {
}
func testMigratorPublisherCustomScheduler() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
+11 -11
View File
@@ -49,7 +49,7 @@ class DatabaseReaderTests : GRDBTestCase {
#endif
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_ReadCanRead() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
try dbWriter.write { db in
@@ -91,7 +91,7 @@ class DatabaseReaderTests : GRDBTestCase {
#endif
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_ReadPreventsDatabaseModification() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
do {
@@ -135,7 +135,7 @@ class DatabaseReaderTests : GRDBTestCase {
#endif
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_UnsafeReadCanRead() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
try dbWriter.write { db in
@@ -347,7 +347,7 @@ class DatabaseReaderTests : GRDBTestCase {
// MARK: - Task Cancellation
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_read_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -383,7 +383,7 @@ class DatabaseReaderTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_read_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -420,7 +420,7 @@ class DatabaseReaderTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_statement_execution_from_read_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -459,7 +459,7 @@ class DatabaseReaderTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_cursor_iteration_from_read_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -502,7 +502,7 @@ class DatabaseReaderTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_unsafeRead_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -538,7 +538,7 @@ class DatabaseReaderTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_unsafeRead_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -575,7 +575,7 @@ class DatabaseReaderTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_statement_execution_from_unsafeRead_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -614,7 +614,7 @@ class DatabaseReaderTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_cursor_iteration_from_unsafeRead_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbReader: some DatabaseReader) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -9,7 +9,7 @@ class DatabaseRegionObservationTests: GRDBTestCase {
_ = observation.start(in: writer, onError: { _ in }, onChange: { _ in })
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
_ = observation.publisher(in: writer)
}
}
@@ -229,7 +229,7 @@ final class DatabaseSnapshotPoolTests: GRDBTestCase {
try XCTAssertEqual(dbPool.read(counter.value), 2)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_read_async() async throws {
let dbPool = try makeDatabasePool()
let counter = try Counter(dbPool: dbPool) // 0
@@ -26,7 +26,7 @@ private struct RecordWithUUID<Strategy: StrategyProvider>: EncodableRecord, Enco
var uuid: UUID
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension RecordWithUUID: Identifiable {
var id: UUID { uuid }
}
@@ -39,7 +39,7 @@ private struct RecordWithOptionalUUID<Strategy: StrategyProvider>: EncodableReco
var uuid: UUID?
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension RecordWithOptionalUUID: Identifiable {
var id: UUID? { uuid }
}
@@ -190,7 +190,7 @@ extension DatabaseUUIDEncodingStrategyTests {
}
func testFilterID() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Identifiable not available")
}
@@ -309,7 +309,7 @@ extension DatabaseUUIDEncodingStrategyTests {
}
func testDeleteID() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Identifiable not available")
}
+18 -18
View File
@@ -275,7 +275,7 @@ class DatabaseWriterTests : GRDBTestCase {
try DatabaseQueue().backup(to: dbQueue)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_write() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
try dbWriter.write { db in
@@ -295,7 +295,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(setup(makeDatabasePool()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_writeWithoutTransaction() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
try dbWriter.write { db in
@@ -318,7 +318,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(setup(makeDatabasePool()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_barrierWriteWithoutTransaction() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
try dbWriter.write { db in
@@ -341,7 +341,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(setup(makeDatabasePool()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_erase() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
try dbWriter.write { db in
@@ -359,7 +359,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(setup(makeDatabasePool()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_vacuum() async throws {
func setup<T: DatabaseWriter>(_ dbWriter: T) throws -> T {
try dbWriter.write { db in
@@ -406,7 +406,7 @@ class DatabaseWriterTests : GRDBTestCase {
}
/// A test related to <https://github.com/groue/GRDB.swift/issues/1456>
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncWriteThenRead() async throws {
/// An async read performed after an async write should see the write.
func test(_ dbWriter: some DatabaseWriter) async throws {
@@ -430,7 +430,7 @@ class DatabaseWriterTests : GRDBTestCase {
// MARK: - Task Cancellation
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_writeWithoutTransaction_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -461,7 +461,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_writeWithoutTransaction_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -493,7 +493,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_statement_execution_from_writeWithoutTransaction_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -527,7 +527,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_cursor_iteration_from_writeWithoutTransaction_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -565,7 +565,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_write_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -596,7 +596,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_write_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -628,7 +628,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_statement_execution_from_write_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -662,7 +662,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_cursor_iteration_from_write_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -700,7 +700,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_barrierWriteWithoutTransaction_is_cancelled_by_Task_cancellation_performed_before_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -731,7 +731,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_barrierWriteWithoutTransaction_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -763,7 +763,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_statement_execution_from_barrierWriteWithoutTransaction_is_cancelled_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
@@ -797,7 +797,7 @@ class DatabaseWriterTests : GRDBTestCase {
try await test(AnyDatabaseWriter(makeDatabaseQueue()))
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_cursor_iteration_from_barrierWriteWithoutTransaction_is_interrupted_by_Task_cancellation_performed_after_database_access() async throws {
func test(_ dbWriter: some DatabaseWriter) async throws {
let semaphore = AsyncSemaphore(value: 0)
+3 -3
View File
@@ -92,7 +92,7 @@ private struct FlatModel: FetchableRecord {
self.t5count = row.scopes[Scopes.suffix]!["t5count"]
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
static func modernAll() -> some FetchRequest<FlatModel> {
all()
}
@@ -138,7 +138,7 @@ private struct CodableFlatModel: FetchableRecord, Codable {
var t3: T3?
var t5count: Int
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
static func modernAll() -> some FetchRequest<CodableFlatModel> {
all()
}
@@ -186,7 +186,7 @@ private struct CodableNestedModel: FetchableRecord, Codable {
var t3: T3?
var t5count: Int
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
static func modernAll() -> some FetchRequest<CodableNestedModel> {
all()
}
@@ -41,7 +41,7 @@ private class MinimalNonOptionalPrimaryKeySingle: Record, Hashable {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension MinimalNonOptionalPrimaryKeySingle: Identifiable { }
class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
@@ -473,7 +473,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertTrue(try cursor.next() == nil) // end
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [String] = []
let cursor = try MinimalNonOptionalPrimaryKeySingle.fetchCursor(db, ids: ids)
@@ -512,7 +512,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [String] = []
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchAll(db, ids: ids)
@@ -550,7 +550,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [String] = []
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.fetchSet(db, ids: ids)
@@ -585,7 +585,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let fetchedRecord = try MinimalNonOptionalPrimaryKeySingle.fetchOne(db, id: record.id)!
XCTAssertTrue(fetchedRecord.id == record.id)
@@ -613,7 +613,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
_ = try MinimalNonOptionalPrimaryKeySingle.find(db, key: "missing")
XCTFail("Expected RecordError")
@@ -653,7 +653,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertTrue(try cursor.next() == nil) // end
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [String] = []
let cursor = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchCursor(db)
@@ -692,7 +692,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [String] = []
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchAll(db)
@@ -730,7 +730,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map { $0.id }), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [String] = []
let fetchedRecords = try MinimalNonOptionalPrimaryKeySingle.filter(ids: ids).fetchSet(db)
@@ -765,7 +765,7 @@ class RecordMinimalNonOptionalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"id\" = '\(record.id)'")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let fetchedRecord = try MinimalNonOptionalPrimaryKeySingle.filter(id: record.id).fetchOne(db)!
XCTAssertTrue(fetchedRecord.id == record.id)
@@ -45,7 +45,7 @@ class MinimalRowID : Record, Hashable {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension MinimalRowID: Identifiable { }
class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
@@ -507,7 +507,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertTrue(try cursor.next() == nil) // end
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let cursor = try MinimalRowID.fetchCursor(db, ids: ids)
@@ -546,7 +546,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let fetchedRecords = try MinimalRowID.fetchAll(db, ids: ids)
@@ -584,7 +584,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let fetchedRecords = try MinimalRowID.fetchSet(db, ids: ids)
@@ -619,7 +619,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let fetchedRecord = try MinimalRowID.fetchOne(db, id: record.id!)!
XCTAssertTrue(fetchedRecord.id == record.id)
@@ -650,7 +650,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
_ = try MinimalRowID.find(db, id: -1)
XCTFail("Expected RecordError")
@@ -693,7 +693,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertTrue(try cursor.next() == nil) // end
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let cursor = try MinimalRowID.filter(ids: ids).fetchCursor(db)
@@ -732,7 +732,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchAll(db)
@@ -770,7 +770,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let fetchedRecords = try MinimalRowID.filter(ids: ids).fetchSet(db)
@@ -805,7 +805,7 @@ class RecordMinimalPrimaryKeyRowIDTests : GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalRowIDs\" WHERE \"id\" = \(record.id!)")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let fetchedRecord = try MinimalRowID.filter(id: record.id!).fetchOne(db)!
XCTAssertTrue(fetchedRecord.id == record.id)
@@ -39,7 +39,7 @@ class MinimalSingle: Record, Hashable {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension MinimalSingle: Identifiable {
/// Test non-optional ID type
var id: String { UUID! }
@@ -531,7 +531,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertTrue(try cursor.next() == nil) // end
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let UUIDs: [String] = []
let cursor = try MinimalSingle.fetchCursor(db, ids: UUIDs)
@@ -572,7 +572,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let UUIDs: [String] = []
let fetchedRecords = try MinimalSingle.fetchAll(db, ids: UUIDs)
@@ -612,7 +612,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let UUIDs: [String] = []
let fetchedRecords = try MinimalSingle.fetchSet(db, ids: UUIDs)
@@ -648,7 +648,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let fetchedRecord = try MinimalSingle.fetchOne(db, id: record.UUID!)!
XCTAssertTrue(fetchedRecord.UUID == record.UUID)
@@ -677,7 +677,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
_ = try MinimalSingle.find(db, id: "missing")
XCTFail("Expected RecordError")
@@ -719,7 +719,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertTrue(try cursor.next() == nil) // end
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let UUIDs: [String] = []
let cursor = try MinimalSingle.filter(ids: UUIDs).fetchCursor(db)
@@ -760,7 +760,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let UUIDs: [String] = []
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchAll(db)
@@ -800,7 +800,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map { $0.UUID! }), Set(UUIDs))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let UUIDs: [String] = []
let fetchedRecords = try MinimalSingle.filter(ids: UUIDs).fetchSet(db)
@@ -836,7 +836,7 @@ class RecordMinimalPrimaryKeySingleTests: GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"minimalSingles\" WHERE \"UUID\" = '\(record.UUID!)'")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let fetchedRecord = try MinimalSingle.filter(id: record.UUID!).fetchOne(db)!
XCTAssertTrue(fetchedRecord.UUID == record.UUID)
@@ -77,7 +77,7 @@ private class Person : Record, Hashable {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Person: Identifiable { }
class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
@@ -599,7 +599,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertTrue(try cursor.next() == nil) // end
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let cursor = try Person.fetchCursor(db, ids: ids)
@@ -638,7 +638,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let fetchedRecords = try Person.fetchAll(db, ids: ids)
@@ -676,7 +676,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let fetchedRecords = try Person.fetchSet(db, ids: ids)
@@ -714,7 +714,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let fetchedRecord = try Person.fetchOne(db, id: record.id!)!
XCTAssertTrue(fetchedRecord.id == record.id)
@@ -751,7 +751,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
_ = try Person.find(db, id: -1)
XCTFail("Expected RecordError")
@@ -797,7 +797,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertTrue(try cursor.next() == nil) // end
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let cursor = try Person.filter(ids: ids).fetchCursor(db)
@@ -836,7 +836,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let fetchedRecords = try Person.filter(ids: ids).fetchAll(db)
@@ -874,7 +874,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertEqual(Set(fetchedRecords.map(\.id)), Set(ids))
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let ids: [Int64] = []
let fetchedRecords = try Person.filter(ids: ids).fetchSet(db)
@@ -912,7 +912,7 @@ class RecordPrimaryKeyHiddenRowIDTests : GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT *, \"rowid\" FROM \"persons\" WHERE \"rowid\" = \(record.id!)")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
do {
let fetchedRecord = try Person.filter(id: record.id!).fetchOne(db)!
XCTAssertTrue(fetchedRecord.id == record.id)
@@ -120,7 +120,7 @@ class SharedValueObservationTests: GRDBTestCase {
#if canImport(Combine)
func test_immediate_publisher() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -397,7 +397,7 @@ class SharedValueObservationTests: GRDBTestCase {
#if canImport(Combine)
func test_async_publisher() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -525,7 +525,7 @@ class SharedValueObservationTests: GRDBTestCase {
XCTAssertEqual(log.flush(), [])
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_task_observationLifetime() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.write { db in
@@ -622,7 +622,7 @@ class SharedValueObservationTests: GRDBTestCase {
#if canImport(Combine)
func test_task_publisher() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -656,7 +656,7 @@ class SharedValueObservationTests: GRDBTestCase {
}
#endif
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func test_task_whileObserved() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.write { db in
@@ -753,7 +753,7 @@ class SharedValueObservationTests: GRDBTestCase {
#if canImport(Combine)
func test_error_recovery_observationLifetime() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -811,7 +811,7 @@ class SharedValueObservationTests: GRDBTestCase {
#if canImport(Combine)
func test_error_recovery_whileObserved() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Combine is not available")
}
@@ -867,7 +867,7 @@ class SharedValueObservationTests: GRDBTestCase {
}
#endif
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_mainQueue() async throws {
let dbQueue = try makeDatabaseQueue()
try await dbQueue.write { db in
@@ -887,7 +887,7 @@ class SharedValueObservationTests: GRDBTestCase {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_task() async throws {
let dbQueue = try makeDatabaseQueue()
try await dbQueue.write { db in
@@ -805,11 +805,6 @@ class TableDefinitionTests: GRDBTestCase {
guard sqlite3_libversion_number() >= 3025000 else {
throw XCTSkip("ALTER TABLE RENAME COLUMN is not available")
}
#if !GRDBCUSTOMSQLITE && !GRDBCIPHER
guard #available(tvOS 13, *) else {
throw XCTSkip("ALTER TABLE RENAME COLUMN is not available")
}
#endif
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "test") { t in
@@ -833,11 +828,6 @@ class TableDefinitionTests: GRDBTestCase {
guard sqlite3_libversion_number() >= 3025000 else {
throw XCTSkip("ALTER TABLE RENAME COLUMN is not available")
}
#if !GRDBCUSTOMSQLITE && !GRDBCIPHER
guard #available(tvOS 13, *) else {
throw XCTSkip("ALTER TABLE RENAME COLUMN is not available")
}
#endif
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "test") { t in
@@ -357,7 +357,7 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase {
}
func testExistsIdentifiable() throws {
guard #available(macOS 10.15, tvOS 13, *) else {
guard #available(macOS 10.15, *) else {
throw XCTSkip("Identifiable is not available")
}
+9 -9
View File
@@ -6,7 +6,7 @@ private struct Hacker : TableRecord {
var id: Int64? // Optional
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Hacker: Identifiable { }
private struct Person : Codable, PersistableRecord, FetchableRecord, Hashable {
@@ -16,7 +16,7 @@ private struct Person : Codable, PersistableRecord, FetchableRecord, Hashable {
var email: String
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Person: Identifiable { }
private struct Citizenship : TableRecord {
@@ -46,7 +46,7 @@ class TableRecordDeleteTests: GRDBTestCase {
XCTAssertTrue(deleted)
XCTAssertEqual(try Hacker.fetchCount(db), 0)
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [1, "Arthur"])
try XCTAssertFalse(Hacker.deleteOne(db, id: nil))
deleted = try Hacker.deleteOne(db, id: 1)
@@ -62,7 +62,7 @@ class TableRecordDeleteTests: GRDBTestCase {
XCTAssertEqual(deletedCount, 2)
XCTAssertEqual(try Hacker.fetchCount(db), 1)
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [2, "Barbara"])
try db.execute(sql: "INSERT INTO hackers (rowid, name) VALUES (?, ?)", arguments: [3, "Craig"])
let deletedCount = try Hacker.deleteAll(db, ids: [2, 3, 4])
@@ -85,7 +85,7 @@ class TableRecordDeleteTests: GRDBTestCase {
XCTAssertTrue(deleted)
XCTAssertEqual(try Person.fetchCount(db), 0)
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [1, "Arthur", "arthur@example.com"])
deleted = try Person.deleteOne(db, id: 1)
XCTAssertTrue(deleted)
@@ -100,7 +100,7 @@ class TableRecordDeleteTests: GRDBTestCase {
XCTAssertEqual(deletedCount, 2)
XCTAssertEqual(try Person.fetchCount(db), 1)
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [2, "Barbara", "barbara@example.com"])
try db.execute(sql: "INSERT INTO persons (id, name, email) VALUES (?, ?, ?)", arguments: [3, "Craig", "craig@example.com"])
let deletedCount = try Person.deleteAll(db, ids: [2, 3, 4])
@@ -190,7 +190,7 @@ class TableRecordDeleteTests: GRDBTestCase {
try Person.filter(keys: [1, 2]).deleteAll(db)
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (1, 2)")
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
try Person.filter(id: 1).deleteAll(db)
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" = 1")
@@ -279,7 +279,7 @@ class TableRecordDeleteTests: GRDBTestCase {
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" IN (1, 2) RETURNING *")
#if GRDBCUSTOMSQLITE || GRDBCIPHER
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
_ = try Person.filter(id: 1).deleteAndFetchCursor(db).next()
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" WHERE \"id\" = 1 RETURNING *")
@@ -364,7 +364,7 @@ class TableRecordDeleteTests: GRDBTestCase {
}
}
@available(macOS 10.15, tvOS 13, *) // Identifiable
@available(macOS 10.15, *) // Identifiable
func testRequestDeleteAndFetchIds() throws {
#if GRDBCUSTOMSQLITE || GRDBCIPHER
guard sqlite3_libversion_number() >= 3035000 else {
+2 -2
View File
@@ -17,7 +17,7 @@ private struct Player: Codable, PersistableRecord, FetchableRecord, Hashable {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
extension Player: Identifiable { }
private enum Columns: String, ColumnExpression {
@@ -56,7 +56,7 @@ class TableRecordUpdateTests: GRDBTestCase {
UPDATE "player" SET "score" = 0 WHERE "id" IN (1, 2)
""")
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
try Player.filter(id: 1).updateAll(db, assignment)
XCTAssertEqual(self.lastSQLQuery, """
UPDATE "player" SET "score" = 0 WHERE "id" = 1
+6 -6
View File
@@ -117,7 +117,7 @@ class TableTests: GRDBTestCase {
""")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
struct Player: Identifiable { var id: Int64 }
let t = Table<Player>("player")
@@ -129,7 +129,7 @@ class TableTests: GRDBTestCase {
""")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
struct Player: Identifiable { var id: Int64? }
let t = Table<Player>("player")
@@ -806,7 +806,7 @@ class TableTests: GRDBTestCase {
""")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
// Non-optional ID
struct Country: Identifiable { var id: String }
@@ -821,7 +821,7 @@ class TableTests: GRDBTestCase {
""")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
// Optional ID
struct Country: Identifiable { var id: String? }
@@ -920,7 +920,7 @@ class TableTests: GRDBTestCase {
""")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
// Non-optional ID
struct Country: Identifiable { var id: String }
@@ -930,7 +930,7 @@ class TableTests: GRDBTestCase {
""")
}
if #available(macOS 10.15, tvOS 13, *) {
if #available(macOS 10.15, *) {
// Optional ID
struct Country: Identifiable { var id: String? }
@@ -105,7 +105,7 @@ class ValueObservationRegionRecordingTests: GRDBTestCase {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testTupleObservation() throws {
// Here we just test that user can destructure an observed tuple.
// I'm completely paranoid about tuple destructuring - I can't wrap my
@@ -120,7 +120,7 @@ class ValueObservationRegionRecordingTests: GRDBTestCase {
onChange: { (int: Int, string: String) in }) // <- destructure
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testVaryingRegionTrackingImmediateScheduling() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.write {
+17 -17
View File
@@ -5,7 +5,7 @@ import Dispatch
class ValueObservationTests: GRDBTestCase {
// Test passes if it compiles.
// See <https://github.com/groue/GRDB.swift/issues/1541>
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testStartFromAnyDatabaseReader(reader: any DatabaseReader) {
_ = ValueObservation
.trackingConstantRegion { _ in }
@@ -14,7 +14,7 @@ class ValueObservationTests: GRDBTestCase {
// Test passes if it compiles.
// See <https://github.com/groue/GRDB.swift/issues/1541>
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testStartFromAnyDatabaseWriter(writer: any DatabaseWriter) {
_ = ValueObservation
.trackingConstantRegion { _ in }
@@ -23,7 +23,7 @@ class ValueObservationTests: GRDBTestCase {
// Test passes if it compiles.
// See <https://github.com/groue/GRDB.swift/issues/1541>
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testValuesFromAnyDatabaseWriter(writer: any DatabaseWriter) {
func observe<T>(
fetch: @escaping @Sendable (Database) throws -> T
@@ -55,7 +55,7 @@ class ValueObservationTests: GRDBTestCase {
try test(makeDatabasePool())
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testErrorCompletesTheObservation() throws {
struct TestError: Error { }
@@ -105,7 +105,7 @@ class ValueObservationTests: GRDBTestCase {
try test(makeDatabasePool())
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testViewOptimization() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.write {
@@ -143,7 +143,7 @@ class ValueObservationTests: GRDBTestCase {
}
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testPragmaTableOptimization() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.write {
@@ -179,7 +179,7 @@ class ValueObservationTests: GRDBTestCase {
// MARK: - Constant Explicit Region
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testTrackingExplicitRegion() throws {
class TestStream: TextOutputStream {
private var stringsMutex: Mutex<[String]> = Mutex([])
@@ -620,7 +620,7 @@ class ValueObservationTests: GRDBTestCase {
// MARK: - Cancellation
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testCancellableLifetime() throws {
// We need something to change
let dbQueue = try makeDatabaseQueue()
@@ -666,7 +666,7 @@ class ValueObservationTests: GRDBTestCase {
XCTAssertEqual(changesCountMutex.load(), 2)
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testCancellableExplicitCancellation() throws {
// We need something to change
let dbQueue = try makeDatabaseQueue()
@@ -804,7 +804,7 @@ class ValueObservationTests: GRDBTestCase {
try test(makeDatabasePool())
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testIssue1550() throws {
func test(_ writer: some DatabaseWriter) throws {
try writer.write { try $0.execute(sql: "CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT)") }
@@ -852,7 +852,7 @@ class ValueObservationTests: GRDBTestCase {
try test(makeDatabasePool())
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testIssue1209() throws {
func test(_ dbWriter: some DatabaseWriter) throws {
try dbWriter.write {
@@ -903,7 +903,7 @@ class ValueObservationTests: GRDBTestCase {
}
// MARK: - Main Actor
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
@MainActor func test_mainActor_observation() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.write { db in
@@ -939,7 +939,7 @@ class ValueObservationTests: GRDBTestCase {
// MARK: - Async Await
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_values_prefix() async throws {
func test(_ writer: some DatabaseWriter) async throws {
// We need something to change
@@ -977,7 +977,7 @@ class ValueObservationTests: GRDBTestCase {
try await AsyncTest(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_values_break() async throws {
func test(_ writer: some DatabaseWriter) async throws {
// We need something to change
@@ -1019,7 +1019,7 @@ class ValueObservationTests: GRDBTestCase {
try await AsyncTest(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
}
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testAsyncAwait_values_cancelled() async throws {
func test(_ writer: some DatabaseWriter) async throws {
// We need something to change
@@ -1201,7 +1201,7 @@ class ValueObservationTests: GRDBTestCase {
}
// Regression test for <https://github.com/groue/GRDB.swift/issues/1362>
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testIssue1362() throws {
func test(_ writer: some DatabaseWriter) throws {
try writer.write { try $0.execute(sql: "CREATE TABLE s(id INTEGER PRIMARY KEY AUTOINCREMENT)") }
@@ -1292,7 +1292,7 @@ class ValueObservationTests: GRDBTestCase {
}
// Regression test for <https://github.com/groue/GRDB.swift/issues/1383>
@available(macOS 10.15, tvOS 13, *)
@available(macOS 10.15, *)
func testIssue1383_async() throws {
do {
let dbPool = try makeDatabasePool(filename: "test")