forked from kishikawakatsumi/JavaScriptBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSBNSStringTest.m
More file actions
44 lines (33 loc) · 935 Bytes
/
JSBNSStringTest.m
File metadata and controls
44 lines (33 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// JSBNSStringTests.m
// JavaScriptBridge
//
// Created by kishikawa katsumi on 2014/02/06.
// Copyright (c) 2014年 kishikawa katsumi. All rights reserved.
//
#import <XCTest/XCTest.h>
#import "JavaScriptBridge.h"
@interface JSBNSStringTests : XCTestCase
@end
@implementation JSBNSStringTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testStringWithFormat
{
JSContext *context = [[JSContext alloc] init];
[context addScriptingSupport:@"Foundation"];
JSValue *value = nil;
[context evaluateScript:@"var a = NSString.stringWithFormat('Hello %@!', ['World']);"];
value = context[@"a"];
XCTAssertEqualObjects(value.toString, @"Hello World!");
[context evaluateScript:@"var b = NSString.localizedStringWithFormat('Hello %@!', ['World']);"];
value = context[@"b"];
XCTAssertEqualObjects(value.toString, @"Hello World!");
}
@end