Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
57 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
libv8.a is currently ignored during initial development | ||
Once we optomize the size of libv8.a it will be included as part of this project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
libv8.a is currently ignored during initial development | ||
Once we optomize the size of libv8.a it will be included as part of this project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package v8go_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"rogchap.com/v8go" | ||
) | ||
|
||
func TestValueString(t *testing.T) { | ||
t.Parallel() | ||
ctx, _ := v8go.NewContext(nil) | ||
var tests = [...]struct { | ||
name string | ||
source string | ||
out string | ||
}{ | ||
{"Number", `13 * 2`, "26"}, | ||
{"String", `"string"`, "string"}, | ||
{"Object", `let obj = {}; obj`, "[object Object]"}, | ||
{"Date", `new Date("Sun Sep 01 2019 17:11:06 GMT+1000 (AEST)")`, "Sun Sep 01 2019 17:11:06 GMT+1000 (AEST)"}, | ||
{"Function", `let fn = function(){}; fn`, "function(){}"}, | ||
} | ||
|
||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
t.Parallel() | ||
result, _ := ctx.RunScript(tt.source, "test.js") | ||
str := result.String() | ||
if str != tt.out { | ||
t.Errorf("unespected result: expected %q, got %q", tt.out, str) | ||
} | ||
}) | ||
} | ||
} |