Skip to content

Commit

Permalink
Replaced deprecated recordFailureWithDescription:inFile:atLine:expected:
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Torella <luca@scandit.com>
  • Loading branch information
lucatorella committed Dec 30, 2020
1 parent 1a5f833 commit 4950e15
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Bundle/GoogleTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,24 @@ void OnTestPartResult(const TestPartResult& test_part_result) {
if (test_part_result.passed())
return;

int lineNumber = test_part_result.line_number();
NSInteger lineNumber = test_part_result.line_number();
lineNumber = lineNumber >= 0 ? lineNumber : 0;
const char *fileName = test_part_result.file_name();
NSString *path = fileName ? [@(fileName) stringByStandardizingPath] : nil;
NSString *description = @(test_part_result.message());
[_testCase recordFailureWithDescription:description
inFile:path
atLine:(lineNumber >= 0 ? (NSUInteger)lineNumber : 0)
expected:YES];

XCTSourceCodeLocation *location = [[XCTSourceCodeLocation alloc] initWithFilePath:path
lineNumber:lineNumber];
XCTSourceCodeContext *context = [[XCTSourceCodeContext alloc] initWithLocation:location];

XCTIssue *issue = [[XCTIssue alloc] initWithType:XCTIssueTypeAssertionFailure
compactDescription:description
detailedDescription:nil
sourceCodeContext:context
associatedError:nil
attachments:@[]];

[_testCase recordIssue:issue];
}

private:
Expand Down

0 comments on commit 4950e15

Please sign in to comment.