Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/271 Reviewed By: passy Differential Revision: D9861393 Pulled By: jknoxville fbshipit-source-id: d65f751c35028748915023f33f273d6ec45863c8
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::flipper::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
|