mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-13 22:29:45 +08:00
Fixed whitespace bug with RCTModuleMethod parsing
Summary: public White space between the end of the first part of the method selector and the first colon was being included in the JS method name. (See: https://github.com/facebook/react-native/issues/3804) Reviewed By: javache Differential Revision: D2605713 fb-gh-sync-id: b4402c9ede5eb31dd38021c902f046a4e0557814
This commit is contained in:
committed by
facebook-github-bot-6
parent
cb3a07306e
commit
6539b26810
@@ -64,6 +64,8 @@ static BOOL RCTLogsError(void (^block)(void))
|
||||
- (void)doFooWithInteger:(__unused NSInteger)n { }
|
||||
- (void)doFooWithCGRect:(CGRect)s { _s = s; }
|
||||
|
||||
- (void)doFoo : (__unused NSString *)foo { }
|
||||
|
||||
- (void)testNumbersNonnull
|
||||
{
|
||||
{
|
||||
@@ -121,4 +123,22 @@ static BOOL RCTLogsError(void (^block)(void))
|
||||
XCTAssertTrue(CGRectEqualToRect(r, _s));
|
||||
}
|
||||
|
||||
- (void)testWhitespaceTolerance
|
||||
{
|
||||
NSString *methodName = @"doFoo : \t (NSString *)foo";
|
||||
|
||||
__block RCTModuleMethod *method;
|
||||
XCTAssertFalse(RCTLogsError(^{
|
||||
method = [[RCTModuleMethod alloc] initWithObjCMethodName:methodName
|
||||
JSMethodName:nil
|
||||
moduleClass:[self class]];
|
||||
}));
|
||||
|
||||
XCTAssertEqualObjects(method.JSMethodName, @"doFoo");
|
||||
|
||||
XCTAssertFalse(RCTLogsError(^{
|
||||
[method invokeWithBridge:nil module:self arguments:@[@"bar"]];
|
||||
}));
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user