-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added support for SIGTERM * Update KSCrashDoctor_Tests.m * created KSTestModuleConfig Used for sharing the defines for SWIFTPM_MODULE_BUNDLE. * Update KSTestModuleConfig.h * Removed include folder in tests
- Loading branch information
Showing
7 changed files
with
2,641 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#import <XCTest/XCTest.h> | ||
|
||
#import "KSCrashDoctor.h" | ||
#import "KSTestModuleConfig.h" | ||
|
||
@interface KSCrashDoctor_Tests : XCTestCase @end | ||
|
||
@implementation KSCrashDoctor_Tests | ||
|
||
- (NSDictionary<NSString *, id> *)_crashReportAsJSON:(NSString *)filename | ||
{ | ||
NSURL *url = [KS_TEST_MODULE_BUNDLE URLForResource:filename withExtension:@"json"]; | ||
NSData *data = [NSData dataWithContentsOfURL:url]; | ||
return [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; | ||
} | ||
|
||
- (void) testGracefulTermination | ||
{ | ||
id report = [self _crashReportAsJSON:@"sigterm"]; | ||
NSString *diagnostic = [[[KSCrashDoctor alloc] init] diagnoseCrash:report]; | ||
XCTAssertEqual(diagnostic, @"The OS request the app be gracefully terminated."); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// KSTestModuleConfig.h | ||
// | ||
// | ||
// Created by Alexander Cohen on 5/9/24. | ||
// | ||
|
||
#ifndef KSTestModuleConfig_h | ||
#define KSTestModuleConfig_h | ||
|
||
#import <XCTest/XCTest.h> | ||
|
||
#if !defined(KS_TEST_MODULE_BUNDLE) | ||
#ifdef SWIFTPM_MODULE_BUNDLE | ||
#define KS_TEST_MODULE_BUNDLE SWIFTPM_MODULE_BUNDLE | ||
#else | ||
#define KS_TEST_MODULE_BUNDLE ([NSBundle bundleForClass:[self class]]) | ||
#endif | ||
#endif | ||
|
||
#endif // KSTestModuleConfig_h |
Oops, something went wrong.