From 69f69e80829ce752a248f71e38b539195c77426a Mon Sep 17 00:00:00 2001 From: Michael Redig Date: Wed, 15 Jan 2025 16:48:11 -0600 Subject: [PATCH] Show URLFormCoding test case errors in test case --- .../URLEncodedForm/URLDecoderTests.swift | 12 +++++++++--- .../URLEncodedForm/URLEncoderTests.swift | 10 +++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift b/Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift index 4fcc88eb..69b282ef 100644 --- a/Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift +++ b/Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift @@ -17,12 +17,18 @@ import XCTest @testable import Hummingbird final class URLDecodedFormDecoderTests: XCTestCase { - func testForm(_ value: Input, query: String, decoder: URLEncodedFormDecoder = .init()) { + func testForm( + _ value: Input, + query: String, + decoder: URLEncodedFormDecoder = .init(), + file: StaticString = #filePath, + line: UInt = #line + ) { do { let value2 = try decoder.decode(Input.self, from: query) - XCTAssertEqual(value, value2) + XCTAssertEqual(value, value2, file: file, line: line) } catch { - XCTFail("\(error)") + XCTFail("\(error)", file: file, line: line) } } diff --git a/Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift b/Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift index 760b98b4..b51b2de6 100644 --- a/Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift +++ b/Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift @@ -16,22 +16,22 @@ import Hummingbird import XCTest final class URLEncodedFormEncoderTests: XCTestCase { - static func XCTAssertEncodedEqual(_ lhs: String, _ rhs: String) { + static func XCTAssertEncodedEqual(_ lhs: String, _ rhs: String, file: StaticString = #filePath, line: UInt = #line) { let lhs = lhs.split(separator: "&") .sorted { $0 < $1 } .joined(separator: "&") let rhs = rhs.split(separator: "&") .sorted { $0 < $1 } .joined(separator: "&") - XCTAssertEqual(lhs, rhs) + XCTAssertEqual(lhs, rhs, file: file, line: line) } - func testForm(_ value: some Encodable, query: String, encoder: URLEncodedFormEncoder = .init()) { + func testForm(_ value: some Encodable, query: String, encoder: URLEncodedFormEncoder = .init(), file: StaticString = #filePath, line: UInt = #line) { do { let query2 = try encoder.encode(value) - Self.XCTAssertEncodedEqual(query2, query) + Self.XCTAssertEncodedEqual(query2, query, file: file, line: line) } catch { - XCTFail("\(error)") + XCTFail("\(error)", file: file, line: line) } }