Summary: This diff only moves the core of sonarkit to the xplat. - This diff uses `fb_xplat_cxx_library` as a buck rule in xplat as it is the recommended way - Updated few imports in the files which were not compiling with new buck function - Due to the new way of import the OSS would break, so fixed it by changing the `podspec` file Reviewed By: passy Differential Revision: D8937414 fbshipit-source-id: 6e12cd049bedb496e7a6820be85b2535e70ba09b
42 lines
1.0 KiB
Plaintext
42 lines
1.0 KiB
Plaintext
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the LICENSE
|
|
* file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
#import <XCTest/XCTest.h>
|
|
|
|
#if FB_SONARKIT_ENABLED
|
|
|
|
#import <SonarKit/CppBridge/SonarCppWrapperPlugin.h>
|
|
#import <SonarKit/SonarPlugin.h>
|
|
|
|
using facebook::sonar::SonarCppWrapperPlugin;
|
|
|
|
@interface DummyPlugin : NSObject <SonarPlugin>
|
|
@end
|
|
|
|
@implementation DummyPlugin
|
|
- (NSString *)identifier { return @"Dummy"; }
|
|
- (void)didConnect:(id<SonarConnection>)connection {}
|
|
- (void)didDisconnect {}
|
|
@end
|
|
|
|
@interface SonarCppBridgingTests : XCTestCase
|
|
@end
|
|
|
|
@implementation SonarCppBridgingTests
|
|
|
|
- (void)testCppWrapperRetainsObjCPlugin {
|
|
NSObject<SonarPlugin> *dummyPlugin = [DummyPlugin new];
|
|
auto retainCountBefore = CFGetRetainCount((void *)dummyPlugin);
|
|
SonarCppWrapperPlugin wrapperPlugin(dummyPlugin);
|
|
auto retainCountAfter = CFGetRetainCount((void *)dummyPlugin);
|
|
XCTAssertTrue(retainCountAfter > retainCountBefore);
|
|
}
|
|
|
|
@end
|
|
|
|
#endif
|