forked from kishikawakatsumi/JavaScriptBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSBJavaScriptCoreTest.m
More file actions
43 lines (30 loc) · 915 Bytes
/
JSBJavaScriptCoreTest.m
File metadata and controls
43 lines (30 loc) · 915 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
#import <XCTest/XCTest.h>
#import "JavaScriptBridge.h"
@import JavaScriptCore;
@interface JSBJavaScriptCoreTests : XCTestCase
@end
@implementation JSBJavaScriptCoreTests
- (void)setUp
{
[super setUp];
}
- (void)tearDown
{
[super tearDown];
}
- (void)testInstantiation
{
JSContext *context = [[JSContext alloc] init];
[context addScriptingSupport:@"JavaScriptCore"];
JSValue *value = nil;
[context evaluateScript:@"var jscontext = JSContext.new();"];
value = context[@"jscontext"];
XCTAssertTrue(value && !value.isUndefined);
[context evaluateScript:@"var jsmanagedvalue = JSManagedValue.new();"];
value = context[@"jsmanagedvalue"];
XCTAssertTrue(value && !value.isUndefined);
[context evaluateScript:@"var jsvirtualmachine = JSVirtualMachine.new();"];
value = context[@"jsvirtualmachine"];
XCTAssertTrue(value && !value.isUndefined);
}
@end