From 17518d76fd00327c984f77943b4a300331c1a809 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 9 Jul 2024 08:57:08 -0400 Subject: [PATCH 1/5] Fix recordIssue for Xcode beta 3. --- Sources/SnapshotTesting/AssertSnapshot.swift | 2 +- .../SnapshotTesting/Internal/Deprecations.swift | 2 +- .../SnapshotTesting/Internal/RecordIssue.swift | 16 +++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Sources/SnapshotTesting/AssertSnapshot.swift b/Sources/SnapshotTesting/AssertSnapshot.swift index 737f607bb..bbe34fd5f 100644 --- a/Sources/SnapshotTesting/AssertSnapshot.swift +++ b/Sources/SnapshotTesting/AssertSnapshot.swift @@ -72,7 +72,7 @@ public func assertSnapshot( line: line ) guard let message = failure else { return } - recordIssue(message, file: file, line: line) + recordIssue(message, fileID: file, filePath: file, line: line, column: 0) } /// Asserts that a given value matches references on disk. diff --git a/Sources/SnapshotTesting/Internal/Deprecations.swift b/Sources/SnapshotTesting/Internal/Deprecations.swift index debb08dac..a86ffb5af 100644 --- a/Sources/SnapshotTesting/Internal/Deprecations.swift +++ b/Sources/SnapshotTesting/Internal/Deprecations.swift @@ -30,7 +30,7 @@ public func _assertInlineSnapshot( line: line ) guard let message = failure else { return } - recordIssue(message, file: file, line: line) + recordIssue(message, fileID: file, filePath: file, line: line, column: 0) } @available( diff --git a/Sources/SnapshotTesting/Internal/RecordIssue.swift b/Sources/SnapshotTesting/Internal/RecordIssue.swift index 76f0a4c86..00fc2bc40 100644 --- a/Sources/SnapshotTesting/Internal/RecordIssue.swift +++ b/Sources/SnapshotTesting/Internal/RecordIssue.swift @@ -7,18 +7,24 @@ import XCTest @_spi(Internals) public func recordIssue( _ message: @autoclosure () -> String, - file: StaticString = #filePath, - line: UInt = #line + fileID: StaticString = #fileID, + filePath: StaticString = #filePath, + line: UInt = #line, + column: UInt = #column ) { #if canImport(Testing) if Test.current != nil { Issue.record( Comment(rawValue: message()), - filePath: file.description, - line: Int(line) + sourceLocation: SourceLocation( + fileID: fileID.description, + filePath: filePath.description, + line: Int(line), + column: Int(column) + ) ) } else { - XCTFail(message(), file: file, line: line) + XCTFail(message(), file: filePath, line: line) } #else XCTFail(message(), file: file, line: line) From 4419b85fbc4be5de66fc8239453c0e1bf57acfe1 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 9 Jul 2024 09:00:32 -0400 Subject: [PATCH 2/5] wip --- .../AssertInlineSnapshot.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift b/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift index bc78be83e..78eec1bd5 100644 --- a/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift +++ b/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift @@ -70,8 +70,10 @@ import Foundation loaded. If a timeout is unavoidable, consider setting the "timeout" parameter of "assertInlineSnapshot" to a higher value. """, - file: file, - line: line + fileID: file, + filePath: file, + line: line, + column: 0 ) return case .incorrectOrder, .interrupted, .invertedFulfillment: @@ -267,8 +269,11 @@ public struct InlineSnapshotSyntaxDescriptor: Hashable { } recordIssue( message(), - file: file, - line: trailingClosureLine.map(UInt.init) ?? line + fileID: file, + filePath: file, + line: trailingClosureLine.map(UInt.init) ?? line, + column: 0 + ) } From 82a35ed40244cc8525e4cb2f74746709406dc5b6 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 9 Jul 2024 09:01:40 -0400 Subject: [PATCH 3/5] wip --- .../AssertInlineSnapshot.swift | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift b/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift index 78eec1bd5..06d95a719 100644 --- a/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift +++ b/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift @@ -39,7 +39,7 @@ import Foundation timeout: TimeInterval = 5, syntaxDescriptor: InlineSnapshotSyntaxDescriptor = InlineSnapshotSyntaxDescriptor(), matches expected: (() -> String)? = nil, - file: StaticString = #filePath, + file: StaticString = #file, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -77,10 +77,22 @@ import Foundation ) return case .incorrectOrder, .interrupted, .invertedFulfillment: - recordIssue("Couldn't snapshot value", file: file, line: line) + recordIssue( + "Couldn't snapshot value", + fileID: file, + filePath: file, + line: line, + column: 0 + ) return @unknown default: - recordIssue("Couldn't snapshot value", file: file, line: line) + recordIssue( + "Couldn't snapshot value", + fileID: file, + filePath: file, + line: line, + column: 0 + ) return } } @@ -121,8 +133,10 @@ import Foundation Re-run "\(function)" to assert against the newly-recorded snapshot. """, - file: file, - line: line + fileID: file, + filePath: file, + line: line, + column: 0 ) return } @@ -133,8 +147,10 @@ import Foundation """ No expected value to assert against. """, - file: file, - line: line + fileID: file, + filePath: file, + line: line, + column: 0 ) return } @@ -154,7 +170,13 @@ import Foundation column: column ) } catch { - recordIssue("Threw error: \(error)", file: file, line: line) + recordIssue( + "Threw error: \(error)", + fileID: file, + filePath: file, + line: line, + column: 0 + ) } } } From 09f17dcdb852723cfd0ec7cced309fb2dcd9c0ee Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 9 Jul 2024 09:08:34 -0400 Subject: [PATCH 4/5] fix --- Sources/SnapshotTesting/Internal/RecordIssue.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SnapshotTesting/Internal/RecordIssue.swift b/Sources/SnapshotTesting/Internal/RecordIssue.swift index 00fc2bc40..a91d3b591 100644 --- a/Sources/SnapshotTesting/Internal/RecordIssue.swift +++ b/Sources/SnapshotTesting/Internal/RecordIssue.swift @@ -27,6 +27,6 @@ public func recordIssue( XCTFail(message(), file: filePath, line: line) } #else - XCTFail(message(), file: file, line: line) + XCTFail(message(), file: filePath, line: line) #endif } From 3bafb4d7d928825936dfc156948bdd84eb72b5a7 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Tue, 9 Jul 2024 09:10:08 -0700 Subject: [PATCH 5/5] wip --- .../AssertInlineSnapshot.swift | 93 ++++++++++--------- Sources/SnapshotTesting/AssertSnapshot.swift | 70 ++++++++++---- .../Internal/Deprecations.swift | 22 +++-- .../Internal/RecordIssue.swift | 8 +- .../AssertInlineSnapshotSwiftTests.swift | 27 ++++-- .../InlineSnapshotTestingTests.swift | 27 ++++-- 6 files changed, 156 insertions(+), 91 deletions(-) diff --git a/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift b/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift index 06d95a719..9249b27fe 100644 --- a/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift +++ b/Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift @@ -23,14 +23,16 @@ import Foundation /// - expected: An optional closure that returns a previously generated snapshot. When omitted, /// the library will automatically write a snapshot into your test file at the call sight of /// the assertion. - /// - file: The file where the assertion occurs. The default is the filename of the test case - /// where you call this function. + /// - fileID: The file ID in which failure occurred. Defaults to the file ID of the test case in + /// which this function was called. + /// - file: The file in which failure occurred. Defaults to the file path of the test case in + /// which this function was called. /// - function: The function where the assertion occurs. The default is the name of the test /// method where you call this function. - /// - line: The line where the assertion occurs. The default is the line number where you call - /// this function. - /// - column: The column where the assertion occurs. The default is the line column you call - /// this function. + /// - line: The line number on which failure occurred. Defaults to the line number on which this + /// function was called. + /// - column: The column on which failure occurred. Defaults to the column on which this + /// function was called. public func assertInlineSnapshot( of value: @autoclosure () throws -> Value?, as snapshotting: Snapshotting, @@ -39,7 +41,8 @@ import Foundation timeout: TimeInterval = 5, syntaxDescriptor: InlineSnapshotSyntaxDescriptor = InlineSnapshotSyntaxDescriptor(), matches expected: (() -> String)? = nil, - file: StaticString = #file, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -70,28 +73,28 @@ import Foundation loaded. If a timeout is unavoidable, consider setting the "timeout" parameter of "assertInlineSnapshot" to a higher value. """, - fileID: file, - filePath: file, + fileID: fileID, + filePath: filePath, line: line, - column: 0 + column: column ) return case .incorrectOrder, .interrupted, .invertedFulfillment: recordIssue( "Couldn't snapshot value", - fileID: file, - filePath: file, + fileID: fileID, + filePath: filePath, line: line, - column: 0 + column: column ) return @unknown default: recordIssue( "Couldn't snapshot value", - fileID: file, - filePath: file, + fileID: fileID, + filePath: filePath, line: line, - column: 0 + column: column ) return } @@ -102,7 +105,7 @@ import Foundation record != .missing || expected != nil else { // NB: Write snapshot state before calling `XCTFail` in case `continueAfterFailure = false` - inlineSnapshotState[File(path: file), default: []].append( + inlineSnapshotState[File(path: filePath), default: []].append( InlineSnapshot( expected: expected, actual: actual, @@ -133,10 +136,10 @@ import Foundation Re-run "\(function)" to assert against the newly-recorded snapshot. """, - fileID: file, - filePath: file, + fileID: fileID, + filePath: filePath, line: line, - column: 0 + column: column ) return } @@ -147,10 +150,10 @@ import Foundation """ No expected value to assert against. """, - fileID: file, - filePath: file, + fileID: fileID, + filePath: filePath, line: line, - column: 0 + column: column ) return } @@ -165,17 +168,18 @@ import Foundation \(difference.indenting(by: 2)) """, - file: file, + fileID: fileID, + file: filePath, line: line, column: column ) } catch { recordIssue( "Threw error: \(error)", - fileID: file, - filePath: file, + fileID: fileID, + filePath: filePath, line: line, - column: 0 + column: column ) } } @@ -183,13 +187,15 @@ import Foundation #else @available(*, unavailable, message: "'assertInlineSnapshot' requires 'swift-syntax' >= 509.0.0") public func assertInlineSnapshot( - of value: @autoclosure () throws -> Value, + of value: @autoclosure () throws -> Value?, as snapshotting: Snapshotting, message: @autoclosure () -> String = "", + record isRecording: Bool? = nil, timeout: TimeInterval = 5, syntaxDescriptor: InlineSnapshotSyntaxDescriptor = InlineSnapshotSyntaxDescriptor(), matches expected: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -266,20 +272,23 @@ public struct InlineSnapshotSyntaxDescriptor: Hashable { /// /// - Parameters: /// - message: An optional description of the assertion, for inclusion in test results. - /// - file: The file where the assertion occurs. The default is the filename of the test case - /// where you call `assertInlineSnapshot`. - /// - line: The line where the assertion occurs. The default is the line number where you call - /// `assertInlineSnapshot`. - /// - column: The column where the assertion occurs. The default is the column where you call - /// `assertInlineSnapshot`. + /// - fileID: The file ID in which failure occurred. Defaults to the file ID of the test case + /// in which this function was called. + /// - file: The file in which failure occurred. Defaults to the file path of the test case in + /// which this function was called. + /// - line: The line number on which failure occurred. Defaults to the line number on which + /// this function was called. + /// - column: The column on which failure occurred. Defaults to the column on which this + /// function was called. public func fail( _ message: @autoclosure () -> String = "", - file: StaticString, + fileID: StaticString, + file filePath: StaticString, line: UInt, column: UInt ) { var trailingClosureLine: Int? - if let testSource = try? testSource(file: File(path: file)) { + if let testSource = try? testSource(file: File(path: filePath)) { let visitor = SnapshotVisitor( functionCallLine: Int(line), functionCallColumn: Int(column), @@ -291,11 +300,10 @@ public struct InlineSnapshotSyntaxDescriptor: Hashable { } recordIssue( message(), - fileID: file, - filePath: file, + fileID: fileID, + filePath: filePath, line: trailingClosureLine.map(UInt.init) ?? line, - column: 0 - + column: column ) } @@ -306,7 +314,8 @@ public struct InlineSnapshotSyntaxDescriptor: Hashable { @available(*, unavailable, message: "'assertInlineSnapshot' requires 'swift-syntax' >= 509.0.0") public func fail( _ message: @autoclosure () -> String = "", - file: StaticString, + fileID: StaticString, + file filePath: StaticString, line: UInt, column: UInt ) { diff --git a/Sources/SnapshotTesting/AssertSnapshot.swift b/Sources/SnapshotTesting/AssertSnapshot.swift index bbe34fd5f..b2d473d38 100644 --- a/Sources/SnapshotTesting/AssertSnapshot.swift +++ b/Sources/SnapshotTesting/AssertSnapshot.swift @@ -45,21 +45,27 @@ public var _record: SnapshotTestingConfiguration.Record = { /// - name: An optional description of the snapshot. /// - recording: Whether or not to record a new reference. /// - timeout: The amount of time a snapshot must be generated in. -/// - file: The file in which failure occurred. Defaults to the file name of the test case in +/// - fileID: The file ID in which failure occurred. Defaults to the file ID of the test case in +/// which this function was called. +/// - file: The file in which failure occurred. Defaults to the file path of the test case in /// which this function was called. /// - testName: The name of the test in which failure occurred. Defaults to the function name of /// the test case in which this function was called. /// - line: The line number on which failure occurred. Defaults to the line number on which this /// function was called. +/// - column: The column on which failure occurred. Defaults to the column on which this function +/// was called. public func assertSnapshot( of value: @autoclosure () throws -> Value, as snapshotting: Snapshotting, named name: String? = nil, record recording: Bool? = nil, timeout: TimeInterval = 5, - file: StaticString = #file, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, testName: String = #function, - line: UInt = #line + line: UInt = #line, + column: UInt = #column ) { let failure = verifySnapshot( of: try value(), @@ -67,12 +73,20 @@ public func assertSnapshot( named: name, record: recording, timeout: timeout, - file: file, + fileID: fileID, + file: filePath, testName: testName, - line: line + line: line, + column: column ) guard let message = failure else { return } - recordIssue(message, fileID: file, filePath: file, line: line, column: 0) + recordIssue( + message, + fileID: fileID, + filePath: filePath, + line: line, + column: column + ) } /// Asserts that a given value matches references on disk. @@ -83,20 +97,26 @@ public func assertSnapshot( /// comparing values. /// - recording: Whether or not to record a new reference. /// - timeout: The amount of time a snapshot must be generated in. -/// - file: The file in which failure occurred. Defaults to the file name of the test case in +/// - fileID: The file ID in which failure occurred. Defaults to the file ID of the test case in +/// which this function was called. +/// - file: The file in which failure occurred. Defaults to the file path of the test case in /// which this function was called. /// - testName: The name of the test in which failure occurred. Defaults to the function name of /// the test case in which this function was called. /// - line: The line number on which failure occurred. Defaults to the line number on which this /// function was called. +/// - column: The column on which failure occurred. Defaults to the column on which this function +/// was called. public func assertSnapshots( of value: @autoclosure () throws -> Value, as strategies: [String: Snapshotting], record recording: Bool? = nil, timeout: TimeInterval = 5, - file: StaticString = #file, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, testName: String = #function, - line: UInt = #line + line: UInt = #line, + column: UInt = #column ) { try? strategies.forEach { name, strategy in assertSnapshot( @@ -105,9 +125,11 @@ public func assertSnapshots( named: name, record: recording, timeout: timeout, - file: file, + fileID: fileID, + file: filePath, testName: testName, - line: line + line: line, + column: column ) } } @@ -119,20 +141,26 @@ public func assertSnapshots( /// - strategies: An array of strategies for serializing, deserializing, and comparing values. /// - recording: Whether or not to record a new reference. /// - timeout: The amount of time a snapshot must be generated in. -/// - file: The file in which failure occurred. Defaults to the file name of the test case in +/// - fileID: The file ID in which failure occurred. Defaults to the file ID of the test case in +/// which this function was called. +/// - file: The file in which failure occurred. Defaults to the file path of the test case in /// which this function was called. /// - testName: The name of the test in which failure occurred. Defaults to the function name of /// the test case in which this function was called. /// - line: The line number on which failure occurred. Defaults to the line number on which this /// function was called. +/// - column: The column on which failure occurred. Defaults to the column on which this function +/// was called. public func assertSnapshots( of value: @autoclosure () throws -> Value, as strategies: [Snapshotting], record recording: Bool? = nil, timeout: TimeInterval = 5, - file: StaticString = #file, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, testName: String = #function, - line: UInt = #line + line: UInt = #line, + column: UInt = #column ) { try? strategies.forEach { strategy in assertSnapshot( @@ -140,9 +168,11 @@ public func assertSnapshots( as: strategy, record: recording, timeout: timeout, - file: file, + fileID: fileID, + file: filePath, testName: testName, - line: line + line: line, + column: column ) } } @@ -205,9 +235,11 @@ public func verifySnapshot( record recording: Bool? = nil, snapshotDirectory: String? = nil, timeout: TimeInterval = 5, - file: StaticString = #file, + fileID: StaticString = #fileID, + file filePath: StaticString = #file, testName: String = #function, - line: UInt = #line + line: UInt = #line, + column: UInt = #column ) -> String? { CleanCounterBetweenTestCases.registerIfNeeded() @@ -217,7 +249,7 @@ public func verifySnapshot( ?? _record return withSnapshotTesting(record: record) { () -> String? in do { - let fileUrl = URL(fileURLWithPath: "\(file)", isDirectory: false) + let fileUrl = URL(fileURLWithPath: "\(filePath)", isDirectory: false) let fileName = fileUrl.deletingPathExtension().lastPathComponent let snapshotDirectoryUrl = diff --git a/Sources/SnapshotTesting/Internal/Deprecations.swift b/Sources/SnapshotTesting/Internal/Deprecations.swift index a86ffb5af..ce93f2f7f 100644 --- a/Sources/SnapshotTesting/Internal/Deprecations.swift +++ b/Sources/SnapshotTesting/Internal/Deprecations.swift @@ -14,9 +14,11 @@ public func _assertInlineSnapshot( record recording: Bool = false, timeout: TimeInterval = 5, with reference: String, - file: StaticString = #file, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, testName: String = #function, - line: UInt = #line + line: UInt = #line, + column: UInt = #column ) { let failure = _verifyInlineSnapshot( @@ -25,12 +27,14 @@ public func _assertInlineSnapshot( record: recording, timeout: timeout, with: reference, - file: file, + fileID: fileID, + file: filePath, testName: testName, - line: line + line: line, + column: column ) guard let message = failure else { return } - recordIssue(message, fileID: file, filePath: file, line: line, column: 0) + recordIssue(message, fileID: fileID, filePath: filePath, line: line, column: column) } @available( @@ -44,9 +48,11 @@ public func _verifyInlineSnapshot( record recording: Bool = false, timeout: TimeInterval = 5, with reference: String, - file: StaticString = #file, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, testName: String = #function, - line: UInt = #line + line: UInt = #line, + column: UInt = #column ) -> String? { @@ -94,7 +100,7 @@ public func _verifyInlineSnapshot( // If that diff failed, we either record or fail. if recording || trimmedReference.isEmpty { - let fileName = "\(file)" + let fileName = "\(filePath)" let sourceCodeFilePath = URL(fileURLWithPath: fileName, isDirectory: false) let sourceCode = try String(contentsOf: sourceCodeFilePath) var newRecordings = recordings diff --git a/Sources/SnapshotTesting/Internal/RecordIssue.swift b/Sources/SnapshotTesting/Internal/RecordIssue.swift index a91d3b591..01c700df8 100644 --- a/Sources/SnapshotTesting/Internal/RecordIssue.swift +++ b/Sources/SnapshotTesting/Internal/RecordIssue.swift @@ -7,10 +7,10 @@ import XCTest @_spi(Internals) public func recordIssue( _ message: @autoclosure () -> String, - fileID: StaticString = #fileID, - filePath: StaticString = #filePath, - line: UInt = #line, - column: UInt = #column + fileID: StaticString, + filePath: StaticString, + line: UInt, + column: UInt ) { #if canImport(Testing) if Test.current != nil { diff --git a/Tests/InlineSnapshotTestingTests/AssertInlineSnapshotSwiftTests.swift b/Tests/InlineSnapshotTestingTests/AssertInlineSnapshotSwiftTests.swift index 448925cd5..0a193452c 100644 --- a/Tests/InlineSnapshotTestingTests/AssertInlineSnapshotSwiftTests.swift +++ b/Tests/InlineSnapshotTestingTests/AssertInlineSnapshotSwiftTests.swift @@ -102,7 +102,8 @@ @Test func argumentlessInlineSnapshot() { func assertArgumentlessInlineSnapshot( expected: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -115,7 +116,8 @@ trailingClosureOffset: 1 ), matches: expected, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column @@ -135,7 +137,8 @@ of url: () -> String, head: (() -> String)? = nil, body: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -152,7 +155,8 @@ trailingClosureOffset: 1 ), matches: head, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column @@ -178,7 +182,8 @@ trailingClosureOffset: 2 ), matches: body, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column @@ -215,7 +220,8 @@ func assertAsyncThrowingInlineSnapshot( of value: () -> String, is expected: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -228,7 +234,8 @@ trailingClosureOffset: 1 ), matches: expected, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column @@ -284,7 +291,8 @@ private func assertCustomInlineSnapshot( of value: () -> String, is expected: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -297,7 +305,8 @@ trailingClosureOffset: 1 ), matches: expected, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column diff --git a/Tests/InlineSnapshotTestingTests/InlineSnapshotTestingTests.swift b/Tests/InlineSnapshotTestingTests/InlineSnapshotTestingTests.swift index 70bace93c..42198acbf 100644 --- a/Tests/InlineSnapshotTestingTests/InlineSnapshotTestingTests.swift +++ b/Tests/InlineSnapshotTestingTests/InlineSnapshotTestingTests.swift @@ -102,7 +102,8 @@ final class InlineSnapshotTestingTests: XCTestCase { func testArgumentlessInlineSnapshot() { func assertArgumentlessInlineSnapshot( expected: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -115,7 +116,8 @@ final class InlineSnapshotTestingTests: XCTestCase { trailingClosureOffset: 1 ), matches: expected, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column @@ -135,7 +137,8 @@ final class InlineSnapshotTestingTests: XCTestCase { of url: () -> String, head: (() -> String)? = nil, body: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -152,7 +155,8 @@ final class InlineSnapshotTestingTests: XCTestCase { trailingClosureOffset: 1 ), matches: head, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column @@ -178,7 +182,8 @@ final class InlineSnapshotTestingTests: XCTestCase { trailingClosureOffset: 2 ), matches: body, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column @@ -215,7 +220,8 @@ final class InlineSnapshotTestingTests: XCTestCase { func assertAsyncThrowingInlineSnapshot( of value: () -> String, is expected: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -228,7 +234,8 @@ final class InlineSnapshotTestingTests: XCTestCase { trailingClosureOffset: 1 ), matches: expected, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column @@ -284,7 +291,8 @@ final class InlineSnapshotTestingTests: XCTestCase { private func assertCustomInlineSnapshot( of value: () -> String, is expected: (() -> String)? = nil, - file: StaticString = #filePath, + fileID: StaticString = #fileID, + file filePath: StaticString = #filePath, function: StaticString = #function, line: UInt = #line, column: UInt = #column @@ -297,7 +305,8 @@ private func assertCustomInlineSnapshot( trailingClosureOffset: 1 ), matches: expected, - file: file, + fileID: fileID, + file: filePath, function: function, line: line, column: column