mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
test RCTHost doesn't leak memory (#37896)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37896 Changelog: [Internal] example usage of the memory test utilities Reviewed By: cipolleschi Differential Revision: D46625917 fbshipit-source-id: 379a76e59fb58cc4e5972195df167c52170f5e4c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e822056618
commit
cc7da26f44
@@ -7,6 +7,7 @@
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import <RCTTestUtils/RCTMemoryUtils.h>
|
||||
#import <RCTTestUtils/ShimRCTInstance.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTMockDef.h>
|
||||
@@ -47,6 +48,8 @@ static ShimRCTInstance *shimmedRCTInstance;
|
||||
{
|
||||
[super setUp];
|
||||
|
||||
RCTAutoReleasePoolPush();
|
||||
|
||||
shimmedRCTInstance = [ShimRCTInstance new];
|
||||
|
||||
_mockHostDelegate = OCMProtocolMock(@protocol(RCTHostDelegate));
|
||||
@@ -60,6 +63,14 @@ static ShimRCTInstance *shimmedRCTInstance;
|
||||
|
||||
- (void)tearDown
|
||||
{
|
||||
RCTAutoReleasePoolPop();
|
||||
|
||||
_subject = nil;
|
||||
XCTAssertEqual(RCTGetRetainCount(_subject), 0);
|
||||
|
||||
_mockHostDelegate = nil;
|
||||
XCTAssertEqual(RCTGetRetainCount(_mockHostDelegate), 0);
|
||||
|
||||
[shimmedRCTInstance reset];
|
||||
gLogCalledTimes = 0;
|
||||
gLogMessage = nil;
|
||||
|
||||
Reference in New Issue
Block a user