From bedea2528325a53a98253989ca7fe95a17619ec8 Mon Sep 17 00:00:00 2001 From: Gus Cairo Date: Tue, 23 Jul 2024 14:19:09 +0100 Subject: [PATCH] Fix FuzzTests unit tests --- Tests/SwiftProtobufTests/Test_FuzzTests.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tests/SwiftProtobufTests/Test_FuzzTests.swift b/Tests/SwiftProtobufTests/Test_FuzzTests.swift index e53cafd72..23ffd0f1b 100644 --- a/Tests/SwiftProtobufTests/Test_FuzzTests.swift +++ b/Tests/SwiftProtobufTests/Test_FuzzTests.swift @@ -55,7 +55,12 @@ final class Test_FuzzTests: XCTestCase { func assertTextFormatFails(_ asBytes: [UInt8], options: TextFormatDecodingOptions = TextFormatDecodingOptions(), file: XCTestFileArgType = #file, line: UInt = #line) { guard let str = String(data: Data(asBytes), encoding: .utf8) else { - XCTFail("Failed to make a string", file: file, line: line) + print( + """ + Failed to make string (at \(file):\(line)): nothing to try and decode. + The fuzzer does not fail in this case and neither should we, skipping test. + """ + ) return } XCTAssertThrowsError( @@ -75,7 +80,12 @@ final class Test_FuzzTests: XCTestCase { func assertTextFormatSucceeds(_ asBytes: [UInt8], options: TextFormatDecodingOptions = TextFormatDecodingOptions(), file: XCTestFileArgType = #file, line: UInt = #line) { guard let str = String(data: Data(asBytes), encoding: .utf8) else { - XCTFail("Failed to make a string", file: file, line: line) + print( + """ + Failed to make string (at \(file):\(line)): nothing to try and decode. + The fuzzer does not fail in this case and neither should we, skipping test. + """ + ) return } XCTAssertNoThrow(