forked from rogchap/v8go
-
Notifications
You must be signed in to change notification settings - Fork 7
/
yao_test.go
74 lines (58 loc) · 1.19 KB
/
yao_test.go
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package v8go_test
import (
"fmt"
"testing"
v8 "rogchap.com/v8go"
)
func TestYaoVersionPrint(t *testing.T) {
v := v8.Version()
fmt.Println("Version", v)
}
func TestYaoInit(t *testing.T) {
t.Parallel()
v8.YaoInit(1024)
defer v8.YaoDispose()
iso := v8.YaoNewIsolate()
defer iso.Dispose()
// stat := iso.GetHeapStatistics()
// if stat.HeapSizeLimit > 1100*1024*1024 {
// t.Errorf("HeapSizeLimit error %d", stat.HeapSizeLimit)
// }
}
func TestYaoCopyIsolate(t *testing.T) {
t.Parallel()
v8.YaoInit(1024)
defer v8.YaoDispose()
iso := v8.YaoNewIsolate()
defer iso.Dispose()
new, err := iso.Copy()
if err != nil {
t.Error(err)
}
defer new.Dispose()
}
func TestYaoIsolateContext(t *testing.T) {
v8.YaoInit(1024)
defer v8.YaoDispose()
iso := v8.YaoNewIsolate()
defer iso.Dispose()
_, err := iso.Context()
if err != nil {
t.Error(err)
}
}
// func TestYaoNewIsolateFromGlobal(t *testing.T) {
// v8.YaoInit(1024)
// defer v8.YaoDispose()
// iso := v8.YaoNewIsolate()
// iso.AsGlobal()
// iso.Dispose()
// new, err := v8.YaoNewIsolateFromGlobal()
// if err != nil {
// t.Error(err)
// }
// if new == nil {
// t.Errorf("new is nil")
// }
// defer new.Dispose()
// }