2015-07-13 15:42:32 +00:00
|
|
|
/**
|
2017-05-06 03:50:47 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
2015-07-13 15:42:32 +00:00
|
|
|
*
|
2017-05-06 03:50:47 +00:00
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
2015-07-13 15:42:32 +00:00
|
|
|
*
|
|
|
|
*/
|
2015-06-06 20:37:36 +00:00
|
|
|
|
|
|
|
#import <mach/mach_time.h>
|
|
|
|
|
|
|
|
#import <XCTest/XCTest.h>
|
|
|
|
|
2016-11-24 17:44:51 +00:00
|
|
|
#import <React/RCTJSCExecutor.h>
|
2015-06-06 20:37:36 +00:00
|
|
|
|
2015-12-16 10:49:27 +00:00
|
|
|
@interface RCTJSCExecutorTests : XCTestCase
|
2015-06-06 20:37:36 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2015-12-16 10:49:27 +00:00
|
|
|
@implementation RCTJSCExecutorTests
|
2015-06-09 22:42:10 +00:00
|
|
|
{
|
2015-12-16 10:49:27 +00:00
|
|
|
RCTJSCExecutor *_executor;
|
2015-06-09 22:42:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setUp
|
|
|
|
{
|
|
|
|
[super setUp];
|
2015-12-16 10:49:27 +00:00
|
|
|
_executor = [RCTJSCExecutor new];
|
2015-06-09 22:42:10 +00:00
|
|
|
[_executor setUp];
|
|
|
|
}
|
2015-06-06 20:37:36 +00:00
|
|
|
|
|
|
|
- (void)testNativeLoggingHookExceptionBehavior
|
|
|
|
{
|
|
|
|
dispatch_semaphore_t doneSem = dispatch_semaphore_create(0);
|
2015-10-16 15:10:25 +00:00
|
|
|
[_executor executeApplicationScript:[@"var x = {toString: function() { throw 1; }}; nativeLoggingHook(x);" dataUsingEncoding:NSUTF8StringEncoding]
|
2015-06-06 20:37:36 +00:00
|
|
|
sourceURL:[NSURL URLWithString:@"file://"]
|
2015-06-15 14:53:45 +00:00
|
|
|
onComplete:^(__unused id error){
|
2015-06-06 20:37:36 +00:00
|
|
|
dispatch_semaphore_signal(doneSem);
|
|
|
|
}];
|
|
|
|
dispatch_semaphore_wait(doneSem, DISPATCH_TIME_FOREVER);
|
2015-06-09 22:42:10 +00:00
|
|
|
[_executor invalidate];
|
2015-06-06 20:37:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|