Run CLANGFORMAT for FlipperKitTests

Summary:
This diff runs CLANGFORMAT lint on FlipperKitTestUtils. I have added CLANGFORMAT as the lint engined for objc files in xplat/sonar. Right now the iOS folder is not formatted according to CLANGFORMAT.
Ran `arc lint -a --paths-cmd "find ./iOS/FlipperKitTests -type f" --verbose`

Reviewed By: passy

Differential Revision: D19942172

fbshipit-source-id: 58322ef6a3a93f9666b3114e872a3a81a3c1cb35
This commit is contained in:
Pritesh Nandgaonkar
2020-02-17 10:46:43 -08:00
committed by Facebook Github Bot
parent 36deab1d52
commit 38478842df
3 changed files with 260 additions and 175 deletions

View File

@@ -8,14 +8,14 @@
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
#if FB_SONARKIT_ENABLED #if FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperPlugin.h>
#import <FlipperKit/FlipperClient.h>
#import <FlipperKit/FlipperClient+Testing.h> #import <FlipperKit/FlipperClient+Testing.h>
#import <FlipperKit/FlipperClient.h>
#import <FlipperKit/FlipperConnection.h> #import <FlipperKit/FlipperConnection.h>
#import <FlipperKit/FlipperPlugin.h>
#import <FlipperKitTestUtils/BlockBasedSonarPlugin.h> #import <FlipperKitTestUtils/BlockBasedSonarPlugin.h>
#import <FlipperTestLib/FlipperResponderMock.h>
#import <FlipperTestLib/FlipperConnectionManagerMock.h> #import <FlipperTestLib/FlipperConnectionManagerMock.h>
#import <FlipperTestLib/FlipperPluginMock.h> #import <FlipperTestLib/FlipperPluginMock.h>
#import <FlipperTestLib/FlipperResponderMock.h>
#import <folly/json.h> #import <folly/json.h>
#import <vector> #import <vector>
@@ -24,218 +24,293 @@
@end @end
@implementation FlipperClientTests @implementation FlipperClientTests
facebook::flipper::FlipperClient *client; facebook::flipper::FlipperClient* client;
facebook::flipper::test::FlipperConnectionManagerMock *socket; facebook::flipper::test::FlipperConnectionManagerMock* socket;
FlipperClient *objcClient; FlipperClient* objcClient;
- (void)setUp { - (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class. // Put setup code here. This method is called before the invocation of each
socket = new facebook::flipper::test::FlipperConnectionManagerMock; // test method in the class.
auto state = std::make_shared<FlipperState>(); socket = new facebook::flipper::test::FlipperConnectionManagerMock;
auto state = std::make_shared<FlipperState>();
client = new facebook::flipper::FlipperClient(std::unique_ptr<facebook::flipper::test::FlipperConnectionManagerMock>{socket}, state);
objcClient = [[FlipperClient alloc] initWithCppClient:client];
client = new facebook::flipper::FlipperClient(
std::unique_ptr<facebook::flipper::test::FlipperConnectionManagerMock>{
socket},
state);
objcClient = [[FlipperClient alloc] initWithCppClient:client];
} }
- (void)tearDown { - (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class. // Put teardown code here. This method is called after the invocation of each
delete client; // test method in the class.
delete client;
} }
- (void)testGetPlugin { - (void)testGetPlugin {
BlockBasedSonarPlugin* cat =
[[BlockBasedSonarPlugin alloc] initIdentifier:@"cat"
connect:nil
disconnect:nil];
BlockBasedSonarPlugin* dog =
[[BlockBasedSonarPlugin alloc] initIdentifier:@"dog"
connect:nil
disconnect:nil];
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat" connect:nil disconnect:nil]; [objcClient addPlugin:cat];
BlockBasedSonarPlugin *dog = [[BlockBasedSonarPlugin alloc] initIdentifier:@"dog" connect:nil disconnect:nil]; [objcClient addPlugin:dog];
[objcClient addPlugin:cat]; NSObject<FlipperPlugin>* retrievedPlugin =
[objcClient addPlugin:dog]; [objcClient pluginWithIdentifier:@"cat"];
XCTAssertEqual(retrievedPlugin, cat);
NSObject<FlipperPlugin> *retrievedPlugin = [objcClient pluginWithIdentifier:@"cat"]; retrievedPlugin = [objcClient pluginWithIdentifier:@"dog"];
XCTAssertEqual(retrievedPlugin, cat); XCTAssertEqual(retrievedPlugin, dog);
retrievedPlugin = [objcClient pluginWithIdentifier:@"dog"];
XCTAssertEqual(retrievedPlugin, dog);
} }
- (void)testRemovePlugin { - (void)testRemovePlugin {
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat" connect:nil disconnect:nil]; BlockBasedSonarPlugin* cat =
[[BlockBasedSonarPlugin alloc] initIdentifier:@"cat"
connect:nil
disconnect:nil];
[objcClient addPlugin:cat]; [objcClient addPlugin:cat];
[objcClient removePlugin:cat]; [objcClient removePlugin:cat];
folly::dynamic message = folly::dynamic::object("id", 1)("method", "getPlugins"); folly::dynamic message =
folly::dynamic::object("id", 1)("method", "getPlugins");
std::vector<folly::dynamic> successes = std::vector<folly::dynamic>(); std::vector<folly::dynamic> successes = std::vector<folly::dynamic>();
std::vector<folly::dynamic> errors = std::vector<folly::dynamic>(); std::vector<folly::dynamic> errors = std::vector<folly::dynamic>();
std::unique_ptr<facebook::flipper::FlipperResponderMock> responder = std::make_unique<facebook::flipper::FlipperResponderMock>(&successes, &errors); std::unique_ptr<facebook::flipper::FlipperResponderMock> responder =
socket->callbacks->onMessageReceived(message, std::move(responder)); std::make_unique<facebook::flipper::FlipperResponderMock>(
folly::dynamic expected = folly::dynamic::object("plugins", folly::dynamic::array()); &successes, &errors);
XCTAssertEqual(successes.size(), 1); socket->callbacks->onMessageReceived(message, std::move(responder));
XCTAssertEqual(errors.size(), 0); folly::dynamic expected =
XCTAssertEqual(successes[0], expected); folly::dynamic::object("plugins", folly::dynamic::array());
XCTAssertEqual(successes.size(), 1);
XCTAssertEqual(errors.size(), 0);
XCTAssertEqual(successes[0], expected);
} }
- (void) testPluginActivatedInBackgroundMode { - (void)testPluginActivatedInBackgroundMode {
__block BOOL pluginConnected = NO; __block BOOL pluginConnected = NO;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat" connect:^(id<FlipperConnection>) { BlockBasedSonarPlugin* cat =
pluginConnected = YES; [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat"
} disconnect:^{ connect:^(id<FlipperConnection>) {
pluginConnected = NO; pluginConnected = YES;
}
disconnect:^{
pluginConnected = NO;
}
runInBackground:YES];
} runInBackground: YES]; [objcClient addPlugin:cat];
[objcClient start];
[objcClient addPlugin:cat]; XCTAssertTrue(pluginConnected);
[objcClient start];
XCTAssertTrue(pluginConnected);
} }
- (void) testPluginNotActivatedInNonBackgroundMode { - (void)testPluginNotActivatedInNonBackgroundMode {
__block BOOL pluginConnected = NO; __block BOOL pluginConnected = NO;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat" connect:^(id<FlipperConnection>) { BlockBasedSonarPlugin* cat =
pluginConnected = YES; [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat"
} disconnect:^{ connect:^(id<FlipperConnection>) {
pluginConnected = NO; pluginConnected = YES;
}
disconnect:^{
pluginConnected = NO;
}
runInBackground:NO];
} runInBackground: NO]; [objcClient addPlugin:cat];
[objcClient start];
[objcClient addPlugin:cat]; XCTAssertFalse(pluginConnected);
[objcClient start];
XCTAssertFalse(pluginConnected);
} }
- (void)testConnectAndDisconnectCallbackForNonBackgroundCase { - (void)testConnectAndDisconnectCallbackForNonBackgroundCase {
__block BOOL pluginConnected = NO; __block BOOL pluginConnected = NO;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat" connect:^(id<FlipperConnection>) { BlockBasedSonarPlugin* cat =
pluginConnected = YES; [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat"
} disconnect:^{ connect:^(id<FlipperConnection>) {
pluginConnected = NO; pluginConnected = YES;
} runInBackground: NO]; }
disconnect:^{
pluginConnected = NO;
}
runInBackground:NO];
[objcClient addPlugin:cat]; [objcClient addPlugin:cat];
[objcClient start]; [objcClient start];
folly::dynamic messageInit = folly::dynamic::object("method", "init")("params", folly::dynamic::object("plugin", "cat")); folly::dynamic messageInit = folly::dynamic::object("method", "init")(
std::unique_ptr<facebook::flipper::FlipperResponder> responder = std::make_unique<facebook::flipper::FlipperResponderMock>(); "params", folly::dynamic::object("plugin", "cat"));
std::unique_ptr<facebook::flipper::FlipperResponder> responder =
std::make_unique<facebook::flipper::FlipperResponderMock>();
socket->callbacks->onMessageReceived(messageInit, std::move(responder)); socket->callbacks->onMessageReceived(messageInit, std::move(responder));
XCTAssertTrue(pluginConnected); XCTAssertTrue(pluginConnected);
[objcClient stop]; [objcClient stop];
XCTAssertFalse(pluginConnected); XCTAssertFalse(pluginConnected);
} }
- (void)testConnectAndDisconnectCallbackForBackgroundCase { - (void)testConnectAndDisconnectCallbackForBackgroundCase {
__block BOOL pluginConnected = YES; __block BOOL pluginConnected = YES;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat" connect:^(id<FlipperConnection>) { BlockBasedSonarPlugin* cat =
pluginConnected = YES; [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat"
} disconnect:^{ connect:^(id<FlipperConnection>) {
pluginConnected = NO; pluginConnected = YES;
} runInBackground: YES]; }
disconnect:^{
pluginConnected = NO;
}
runInBackground:YES];
[objcClient addPlugin:cat]; [objcClient addPlugin:cat];
[objcClient start]; [objcClient start];
XCTAssertTrue(pluginConnected); XCTAssertTrue(pluginConnected);
[objcClient stop]; [objcClient stop];
XCTAssertFalse(pluginConnected); XCTAssertFalse(pluginConnected);
} }
- (void)testCrashSuppressionInDidConnectCallback { - (void)testCrashSuppressionInDidConnectCallback {
__block BOOL pluginConnected = NO; __block BOOL pluginConnected = NO;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat" connect:^(id<FlipperConnection>) { BlockBasedSonarPlugin* cat = [[BlockBasedSonarPlugin alloc]
pluginConnected = YES; initIdentifier:@"cat"
NSArray *array = @[]; connect:^(id<FlipperConnection>) {
[array objectAtIndex:10]; //This will throw an exception pluginConnected = YES;
} disconnect:nil runInBackground: YES]; NSArray* array = @[];
[array objectAtIndex:10]; // This will throw an exception
}
disconnect:nil
runInBackground:YES];
[objcClient addPlugin:cat]; [objcClient addPlugin:cat];
// Since background plugin's didconnect is called as soon as flipper client starts // Since background plugin's didconnect is called as soon as flipper client
XCTAssertNoThrow([objcClient start]); // starts
XCTAssertTrue(pluginConnected); // To be sure that connect block is called XCTAssertNoThrow([objcClient start]);
XCTAssertTrue(pluginConnected); // To be sure that connect block is called
} }
- (void)testCrashSuppressionInDisconnectCallback { - (void)testCrashSuppressionInDisconnectCallback {
__block BOOL isCalled = NO; __block BOOL isCalled = NO;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"cat" connect:nil disconnect:^{ BlockBasedSonarPlugin* cat = [[BlockBasedSonarPlugin alloc]
isCalled = YES; initIdentifier:@"cat"
NSArray *array = @[]; connect:nil
[array objectAtIndex:10]; //This will throw an exception disconnect:^{
} runInBackground: YES]; isCalled = YES;
NSArray* array = @[];
[array objectAtIndex:10]; // This will throw an exception
}
runInBackground:YES];
[objcClient addPlugin:cat]; [objcClient addPlugin:cat];
[objcClient start]; [objcClient start];
XCTAssertNoThrow([objcClient stop]); // Stopping client will call disconnect of the plugin XCTAssertNoThrow(
XCTAssertTrue(isCalled); // To be sure that connect block is called [objcClient stop]); // Stopping client will call disconnect of the plugin
XCTAssertTrue(isCalled); // To be sure that connect block is called
} }
- (void)testMethodBlockIsCalledNonBackgroundCase { - (void)testMethodBlockIsCalledNonBackgroundCase {
__block BOOL isCalled = NO; __block BOOL isCalled = NO;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"PluginIdentifier" connect:^(id<FlipperConnection> connection) { BlockBasedSonarPlugin* cat = [[BlockBasedSonarPlugin alloc]
initIdentifier:@"PluginIdentifier"
connect:^(id<FlipperConnection> connection) {
[connection
receive:@"MethodName"
withBlock:^(
NSDictionary* dict, id<FlipperResponder> responder) {
isCalled = YES;
}];
}
disconnect:nil];
[connection receive:@"MethodName" withBlock:^(NSDictionary * dict, id<FlipperResponder> responder) { [objcClient addPlugin:cat];
isCalled = YES; [objcClient start];
}];
} disconnect:nil];
[objcClient addPlugin:cat]; folly::dynamic messageInit = folly::dynamic::object("method", "init")(
[objcClient start]; "params", folly::dynamic::object("plugin", "PluginIdentifier"));
std::unique_ptr<facebook::flipper::FlipperResponder> responder1 =
std::make_unique<facebook::flipper::FlipperResponderMock>();
socket->callbacks->onMessageReceived(messageInit, std::move(responder1));
folly::dynamic message = folly::dynamic::object("id", 1)("method", "execute")(
"params",
folly::dynamic::object("api", "PluginIdentifier")(
"method", "MethodName"));
std::unique_ptr<facebook::flipper::FlipperResponder> responder2 =
std::make_unique<facebook::flipper::FlipperResponderMock>();
folly::dynamic messageInit = folly::dynamic::object("method", "init")("params", folly::dynamic::object("plugin", "PluginIdentifier")); socket->callbacks->onMessageReceived(message, std::move(responder2));
std::unique_ptr<facebook::flipper::FlipperResponder> responder1 = std::make_unique<facebook::flipper::FlipperResponderMock>();
socket->callbacks->onMessageReceived(messageInit, std::move(responder1));
folly::dynamic message = folly::dynamic::object("id", 1)("method", "execute")("params", folly::dynamic::object("api", "PluginIdentifier")("method", "MethodName"));
std::unique_ptr<facebook::flipper::FlipperResponder> responder2 = std::make_unique<facebook::flipper::FlipperResponderMock>();
socket->callbacks->onMessageReceived(message, std::move(responder2)); XCTAssertTrue(isCalled);
XCTAssertTrue(isCalled);
} }
- (void)testMethodBlockIsCalledBackgroundCase { - (void)testMethodBlockIsCalledBackgroundCase {
__block BOOL isCalled = NO; __block BOOL isCalled = NO;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"PluginIdentifier" connect:^(id<FlipperConnection> connection) { BlockBasedSonarPlugin* cat = [[BlockBasedSonarPlugin alloc]
initIdentifier:@"PluginIdentifier"
connect:^(id<FlipperConnection> connection) {
[connection
receive:@"MethodName"
withBlock:^(
NSDictionary* dict, id<FlipperResponder> responder) {
isCalled = YES;
}];
}
disconnect:nil
runInBackground:YES];
[connection receive:@"MethodName" withBlock:^(NSDictionary * dict, id<FlipperResponder> responder) { [objcClient addPlugin:cat];
isCalled = YES; [objcClient start];
}];
} disconnect:nil runInBackground:YES];
[objcClient addPlugin:cat]; folly::dynamic message = folly::dynamic::object("id", 1)("method", "execute")(
[objcClient start]; "params",
folly::dynamic::object("api", "PluginIdentifier")(
"method", "MethodName"));
std::unique_ptr<facebook::flipper::FlipperResponder> responder =
std::make_unique<facebook::flipper::FlipperResponderMock>();
socket->callbacks->onMessageReceived(message, std::move(responder));
folly::dynamic message = folly::dynamic::object("id", 1)("method", "execute")("params", folly::dynamic::object("api", "PluginIdentifier")("method", "MethodName")); XCTAssertTrue(isCalled);
std::unique_ptr<facebook::flipper::FlipperResponder> responder = std::make_unique<facebook::flipper::FlipperResponderMock>();
socket->callbacks->onMessageReceived(message, std::move(responder));
XCTAssertTrue(isCalled);
} }
- (void)testExceptionSuppressionInMethodBlock { - (void)testExceptionSuppressionInMethodBlock {
__block BOOL isCalled = NO; __block BOOL isCalled = NO;
BlockBasedSonarPlugin *cat = [[BlockBasedSonarPlugin alloc] initIdentifier:@"PluginIdentifier" connect:^(id<FlipperConnection> connection) { BlockBasedSonarPlugin* cat = [[BlockBasedSonarPlugin alloc]
initIdentifier:@"PluginIdentifier"
connect:^(id<FlipperConnection> connection) {
[connection
receive:@"MethodName"
withBlock:^(
NSDictionary* dict, id<FlipperResponder> responder) {
isCalled = YES;
NSArray* array = @[];
[array objectAtIndex:10]; // This will throw an exception
}];
}
disconnect:nil
runInBackground:YES];
[connection receive:@"MethodName" withBlock:^(NSDictionary * dict, id<FlipperResponder> responder) { [objcClient addPlugin:cat];
isCalled = YES; [objcClient start];
NSArray *array = @[];
[array objectAtIndex:10]; //This will throw an exception
}];
} disconnect:nil runInBackground:YES];
[objcClient addPlugin:cat]; folly::dynamic message = folly::dynamic::object("id", 1)("method", "execute")(
[objcClient start]; "params",
folly::dynamic::object("api", "PluginIdentifier")(
"method", "MethodName"));
std::vector<folly::dynamic> successes = std::vector<folly::dynamic>();
std::vector<folly::dynamic> errors = std::vector<folly::dynamic>();
std::unique_ptr<facebook::flipper::FlipperResponderMock> responder =
std::make_unique<facebook::flipper::FlipperResponderMock>(
&successes, &errors);
folly::dynamic message = folly::dynamic::object("id", 1)("method", "execute")("params", folly::dynamic::object("api", "PluginIdentifier")("method", "MethodName")); XCTAssertNoThrow(
std::vector<folly::dynamic> successes = std::vector<folly::dynamic>(); socket->callbacks->onMessageReceived(message, std::move(responder)));
std::vector<folly::dynamic> errors = std::vector<folly::dynamic>(); XCTAssertTrue(isCalled);
std::unique_ptr<facebook::flipper::FlipperResponderMock> responder = std::make_unique<facebook::flipper::FlipperResponderMock>(&successes, &errors); XCTAssertEqual(successes.size(), 0);
XCTAssertEqual(errors.size(), 1);
XCTAssertNoThrow(socket->callbacks->onMessageReceived(message, std::move(responder)));
XCTAssertTrue(isCalled);
XCTAssertEqual(successes.size(), 0);
XCTAssertEqual(errors.size(), 1);
} }
@end @end

View File

@@ -14,13 +14,17 @@
using facebook::flipper::FlipperCppWrapperPlugin; using facebook::flipper::FlipperCppWrapperPlugin;
@interface DummyPlugin : NSObject <FlipperPlugin> @interface DummyPlugin : NSObject<FlipperPlugin>
@end @end
@implementation DummyPlugin @implementation DummyPlugin
- (NSString *)identifier { return @"Dummy"; } - (NSString*)identifier {
- (void)didConnect:(id<FlipperConnection>)connection {} return @"Dummy";
- (void)didDisconnect {} }
- (void)didConnect:(id<FlipperConnection>)connection {
}
- (void)didDisconnect {
}
@end @end
@interface FlipperCppBridgingTests : XCTestCase @interface FlipperCppBridgingTests : XCTestCase
@@ -29,10 +33,10 @@ using facebook::flipper::FlipperCppWrapperPlugin;
@implementation FlipperCppBridgingTests @implementation FlipperCppBridgingTests
- (void)testCppWrapperRetainsObjCPlugin { - (void)testCppWrapperRetainsObjCPlugin {
NSObject<FlipperPlugin> *dummyPlugin = [DummyPlugin new]; NSObject<FlipperPlugin>* dummyPlugin = [DummyPlugin new];
auto retainCountBefore = CFGetRetainCount((void *)dummyPlugin); auto retainCountBefore = CFGetRetainCount((void*)dummyPlugin);
FlipperCppWrapperPlugin wrapperPlugin(dummyPlugin); FlipperCppWrapperPlugin wrapperPlugin(dummyPlugin);
auto retainCountAfter = CFGetRetainCount((void *)dummyPlugin); auto retainCountAfter = CFGetRetainCount((void*)dummyPlugin);
XCTAssertTrue(retainCountAfter > retainCountBefore); XCTAssertTrue(retainCountAfter > retainCountBefore);
} }

View File

@@ -8,10 +8,10 @@
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
#if FB_SONARKIT_ENABLED #if FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperPlugin.h>
#import <FlipperKit/FlipperClient.h>
#import <FlipperKit/FlipperClient+Testing.h> #import <FlipperKit/FlipperClient+Testing.h>
#import <FlipperKit/FlipperClient.h>
#import <FlipperKit/FlipperConnection.h> #import <FlipperKit/FlipperConnection.h>
#import <FlipperKit/FlipperPlugin.h>
#import <FlipperKitTestUtils/BlockBasedSonarPlugin.h> #import <FlipperKitTestUtils/BlockBasedSonarPlugin.h>
#import <FlipperKitTestUtils/FlipperResponderMock.h> #import <FlipperKitTestUtils/FlipperResponderMock.h>
#import <FlipperTestLib/FlipperConnectionManagerMock.h> #import <FlipperTestLib/FlipperConnectionManagerMock.h>
@@ -26,35 +26,41 @@
@end @end
@implementation FlipperUtilTests { @implementation FlipperUtilTests {
FlipperResponderMock *responder; FlipperResponderMock* responder;
} }
- (void)setUp { - (void)setUp {
responder = [FlipperResponderMock new]; responder = [FlipperResponderMock new];
} }
- (void)testPerformOnMainThreadSuccess { - (void)testPerformOnMainThreadSuccess {
FlipperPerformBlockOnMainThread(^{}, responder); FlipperPerformBlockOnMainThread(
NSAssert([responder.successes count] == 0, @"No successes are output"); ^{
NSAssert([responder.errors count] == 0, @"No errors are output"); },
responder);
NSAssert([responder.successes count] == 0, @"No successes are output");
NSAssert([responder.errors count] == 0, @"No errors are output");
} }
- (void)testPerformOnMainThreadStdException { - (void)testPerformOnMainThreadStdException {
FlipperPerformBlockOnMainThread(^{ FlipperPerformBlockOnMainThread(
^{
throw new std::exception(); throw new std::exception();
}, responder); },
NSAssert([responder.successes count] == 0, @"No successes are output"); responder);
NSAssert([responder.errors count] == 1, @"1 error is output"); NSAssert([responder.successes count] == 0, @"No successes are output");
NSAssert([responder.errors count] == 1, @"1 error is output");
} }
- (void)testPerformOnMainThreadNSException { - (void)testPerformOnMainThreadNSException {
FlipperPerformBlockOnMainThread(^{ FlipperPerformBlockOnMainThread(
NSArray *a = [NSArray init]; ^{
NSArray* a = [NSArray init];
[a objectAtIndex:1]; [a objectAtIndex:1];
}, responder); },
NSAssert([responder.successes count] == 0, @"No successes are output"); responder);
NSAssert([responder.errors count] == 1, @"1 error is output"); NSAssert([responder.successes count] == 0, @"No successes are output");
NSAssert([responder.errors count] == 1, @"1 error is output");
} }
@end @end