Skip to content

Commit

Permalink
Fix FuzzTests unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcairo authored and thomasvl committed Jul 23, 2024
1 parent 601e03a commit bedea25
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Tests/SwiftProtobufTests/Test_FuzzTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit bedea25

Please sign in to comment.