From 22bdd1e4d868ac0409c4e74ecfd03c3532031fa9 Mon Sep 17 00:00:00 2001 From: Brian Michel Date: Sun, 7 Jan 2024 10:07:44 -0500 Subject: [PATCH] Remove unneeded testing workaround --- Package.swift | 1 - .../_Helpers/AssertSnapshot+Platform.swift | 50 ------------------- 2 files changed, 51 deletions(-) delete mode 100644 Sources/_Helpers/AssertSnapshot+Platform.swift diff --git a/Package.swift b/Package.swift index 94de00c7..8ac5efbf 100644 --- a/Package.swift +++ b/Package.swift @@ -52,7 +52,6 @@ let package = Package( name: "_Helpers", dependencies: [ .product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"), - .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ] ), .target(name: "Functions", dependencies: ["_Helpers"]), diff --git a/Sources/_Helpers/AssertSnapshot+Platform.swift b/Sources/_Helpers/AssertSnapshot+Platform.swift deleted file mode 100644 index feb34eac..00000000 --- a/Sources/_Helpers/AssertSnapshot+Platform.swift +++ /dev/null @@ -1,50 +0,0 @@ -import Foundation -import SnapshotTesting -import XCTest - -/// A platform aware version of the standard `assertSnapshot` -/// This is used to point to different subdirectories of the `__Snapshots__` -/// directory. On different platforms, the different textual representations -/// are different for a number of reasons, so this gives us a way to differentiate -/// where needed. -public func platformSpecificAssertSnapshot( - of value: @autoclosure () throws -> Value, - as snapshotting: Snapshotting, - named name: String? = nil, - record recording: Bool = false, - timeout: TimeInterval = 5, - file: StaticString = #file, - testName: String = #function, - line: UInt = #line -) { - let fileUrl = URL(fileURLWithPath: "\(file)", isDirectory: false) - let fileName = fileUrl.deletingPathExtension().lastPathComponent - - #if os(Linux) - let platformDirectory = "linux" - #elseif os(Windows) - let platformDirectory = "windows" - #else - let platformDirectory = "darwin" - #endif - - let snapshotDirectoryUrl = fileUrl - .deletingLastPathComponent() - .appendingPathComponent("__Snapshots__") - .appendingPathComponent(fileName) - .appendingPathComponent(platformDirectory) - - let failure = verifySnapshot( - of: try value(), - as: snapshotting, - named: name, - record: recording, - snapshotDirectory: snapshotDirectoryUrl.path, - timeout: timeout, - file: file, - testName: testName, - line: line - ) - guard let message = failure else { return } - XCTFail(message, file: file, line: line) -}