diff --git a/DependenciesAdditions.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DependenciesAdditions.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9f878f7..8c83bfa 100644 --- a/DependenciesAdditions.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DependenciesAdditions.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-dependencies", "state" : { - "revision" : "4e1eb6e28afe723286d8cc60611237ffbddba7c5", - "version" : "1.0.0" + "revision" : "350e1e119babe8525f9bd155b76640a5de270184", + "version" : "1.3.0" } }, { @@ -72,6 +72,15 @@ "version" : "1.0.0" } }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-syntax", + "state" : { + "revision" : "303e5c5c36d6a558407d364878df131c3546fad8", + "version" : "510.0.2" + } + }, { "identity" : "swiftui-navigation", "kind" : "remoteSourceControl", @@ -86,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", "state" : { - "revision" : "302891700c7fa3b92ebde9fe7b42933f8349f3c7", - "version" : "1.0.0" + "revision" : "6f30bdba373bbd7fbfe241dddd732651f2fbd1e2", + "version" : "1.1.2" } } ], diff --git a/DependenciesAdditions.xcworkspace/xcshareddata/xcschemes/DependenciesAdditions.xcscheme b/DependenciesAdditions.xcworkspace/xcshareddata/xcschemes/DependenciesAdditions.xcscheme index 8a8b1a5..1233771 100644 --- a/DependenciesAdditions.xcworkspace/xcshareddata/xcschemes/DependenciesAdditions.xcscheme +++ b/DependenciesAdditions.xcworkspace/xcshareddata/xcschemes/DependenciesAdditions.xcscheme @@ -48,16 +48,6 @@ ReferencedContainer = "container:"> - - - - Bool, @autoclosure () -> String, StaticString, UInt) -> Void - - public init(action: @Sendable @escaping (() -> Bool, () -> String, StaticString, UInt) -> Void) { - self.action = action - } - - @inline(__always) - public func callAsFunction( - _ condition: @autoclosure () -> Bool, - _ message: @autoclosure () -> String = "", - file: StaticString = #file, - line: UInt = #line - ) { - action(condition(), message(), file, line) - } -} diff --git a/Sources/AssertionDependency/AssertionFailure.swift b/Sources/AssertionDependency/AssertionFailure.swift deleted file mode 100644 index ba90e43..0000000 --- a/Sources/AssertionDependency/AssertionFailure.swift +++ /dev/null @@ -1,44 +0,0 @@ -import Dependencies -import XCTestDynamicOverlay - -extension DependencyValues { - /// A ``AssertionFailureAction`` that will perform an action when reached. - /// - /// Defaults to calling the standard Swift `assertionFailure` function in live context and - /// producing a test failure in tests. - public var assertionFailure: AssertionFailureAction { - get { self[AssertionFailureAction.self] } - set { self[AssertionFailureAction.self] = newValue } - } -} - -extension AssertionFailureAction: DependencyKey { - public static let liveValue = AssertionFailureAction { - Swift.assertionFailure($0(), file: $1, line: $2) - } - - public static let previewValue = AssertionFailureAction { _, _, _ in - // no-op - } - - public static let testValue = AssertionFailureAction { message, file, line in - XCTFail(message(), file: file, line: line) - } -} - -public struct AssertionFailureAction: Sendable { - public let action: @Sendable (@autoclosure () -> String, StaticString, UInt) -> Void - - public init(action: @Sendable @escaping (() -> String, StaticString, UInt) -> Void) { - self.action = action - } - - @inline(__always) - public func callAsFunction( - _ message: @autoclosure () -> String = "", - file: StaticString = #file, - line: UInt = #line - ) { - action(message(), file, line) - } -} diff --git a/Sources/DependenciesAdditions/Documentation.docc/DependencyAdditions.md b/Sources/DependenciesAdditions/Documentation.docc/DependencyAdditions.md index ca9f7a0..7967cf5 100644 --- a/Sources/DependenciesAdditions/Documentation.docc/DependencyAdditions.md +++ b/Sources/DependenciesAdditions/Documentation.docc/DependencyAdditions.md @@ -19,7 +19,6 @@ on Apple's platforms. |---------------------------------|--------------------------------------| | `AccessibilityDependency` | `\.accessibility` | | `ApplicationDependency` | `\.application` | -| `AssertionDependency` | `\.assert` and `\.assertionFailure` | | `BundleDependency` | `\.bundleInfo` | | `CodableDependency` | `\.encode` and `\.decode` | | `CompressionDependency` | `\.compress` and `\.decompress` | diff --git a/Sources/DependenciesAdditions/Exports.swift b/Sources/DependenciesAdditions/Exports.swift index ac759a7..d3f461c 100644 --- a/Sources/DependenciesAdditions/Exports.swift +++ b/Sources/DependenciesAdditions/Exports.swift @@ -1,6 +1,5 @@ @_exported import AccessibilityDependency @_exported import ApplicationDependency -@_exported import AssertionDependency @_exported import BundleDependency @_exported import CodableDependency @_exported import CompressionDependency diff --git a/Tests/AssertionDependencyTests/AssertionDependencyTests.swift b/Tests/AssertionDependencyTests/AssertionDependencyTests.swift deleted file mode 100644 index c947169..0000000 --- a/Tests/AssertionDependencyTests/AssertionDependencyTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -import AssertionDependency -import Dependencies -import XCTest - -final class AssertionDependencyTests: XCTestCase { - @Dependency(\.assert) var assert - @Dependency(\.assertionFailure) var assertionFailure - - func testAssert() { - assert(true, "Test assertion does not generate failure for true condition") - - #if DEBUG - #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) - XCTExpectFailure { - assert(false, "Test assertion generates failure for false condition") - } - #endif - #endif - - withDependencies { - $0.context = .live - } operation: { - assert(true, "Live assertion does not assert for true condition") - } - } - - #if DEBUG - #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) - func testAssertionFailure() { - XCTExpectFailure { - assertionFailure("Test assertionFailure generates failure") - } - } - #endif - #endif -}