Skip to content

Commit

Permalink
fix: return error v8go
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Sep 23, 2024
1 parent 1f7a778 commit 746423c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 21 deletions.
1 change: 0 additions & 1 deletion errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func TestJSErrorFormat(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if s := fmt.Sprintf("%v", tt.err); s != tt.defaultVerb {
Expand Down
1 change: 0 additions & 1 deletion function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func TestFunctionCallError(t *testing.T) {
require.ErrorAs(t, err, &jsErr)
require.Equal(t, "error", jsErr.Message)
require.Equal(t, "script.js:1:21", jsErr.Location)

}

func TestFunctionSourceMapUrl(t *testing.T) {
Expand Down
6 changes: 2 additions & 4 deletions json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
package v8go_test

import (
"errors"
"fmt"
"testing"

"github.com/stretchr/testify/require"
"github.com/zeiss/v8go"
v8 "github.com/zeiss/v8go"
)
Expand All @@ -29,9 +29,7 @@ func TestJSONParse(t *testing.T) {
}

var jerr *v8go.JSError
if errors.As(err, &jerr) {
t.Errorf("expected error to be of type JSError, got: %T", err)
}
require.ErrorAs(t, err, &jerr)
}

func TestJSONStringify(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions object_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func TestObjectTemplate(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.name, func(t *testing.T) {
setError(t, obj.Set(tt.name, tt.value, 0))
})
Expand Down Expand Up @@ -111,7 +110,6 @@ func TestGlobalObjectTemplate(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
ctx := v8.NewContext(iso, tt.global())
val, err := ctx.RunScript(tt.source, "test.js")
Expand Down
13 changes: 0 additions & 13 deletions value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func TestValueFormatting(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
val, _ := ctx.RunScript(tt.source, "test.js")
if s := fmt.Sprintf("%v", val); s != tt.defaultVerb {
Expand Down Expand Up @@ -86,7 +85,6 @@ func TestValueString(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.name, func(t *testing.T) {
result, _ := ctx.RunScript(tt.source, "test.js")
str := result.String()
Expand Down Expand Up @@ -115,7 +113,6 @@ func TestNewValue(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.name, func(t *testing.T) {
val, err := ctx.RunScript(tt.predicate, "test.js")
if err != nil {
Expand Down Expand Up @@ -160,7 +157,6 @@ func TestValueDetailString(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.name, func(t *testing.T) {
result, _ := ctx.RunScript(tt.source, "test.js")
str := result.DetailString()
Expand Down Expand Up @@ -195,7 +191,6 @@ func TestValueBoolean(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
val, _ := ctx.RunScript(tt.source, "test.js")
if b := val.Boolean(); b != tt.out {
Expand Down Expand Up @@ -258,7 +253,6 @@ func TestValueArrayIndex(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
val, _ := ctx.RunScript(tt.source, "test.js")
idx, ok := val.ArrayIndex()
Expand Down Expand Up @@ -301,7 +295,6 @@ func TestValueInt32(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
val, _ := ctx.RunScript(tt.source, "test.js")
if i32 := val.Int32(); i32 != tt.expected {
Expand Down Expand Up @@ -340,7 +333,6 @@ func TestValueInteger(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
val, _ := ctx.RunScript(tt.source, "test.js")
if i64 := val.Integer(); i64 != tt.expected {
Expand Down Expand Up @@ -377,7 +369,6 @@ func TestValueNumber(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
val, _ := ctx.RunScript(tt.source, "test.js")
f64 := val.Number()
Expand Down Expand Up @@ -410,7 +401,6 @@ func TestValueUint32(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
val, _ := ctx.RunScript(tt.source, "test.js")
if u32 := val.Uint32(); u32 != tt.expected {
Expand Down Expand Up @@ -441,7 +431,6 @@ func TestValueBigInt(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
ctx := v8.NewContext(iso)
defer ctx.Close()
Expand Down Expand Up @@ -636,7 +625,6 @@ func TestValueIsXXX(t *testing.T) {
{"new Proxy({},{})", (*v8.Value).IsProxy},
}
for _, tt := range tests {

t.Run(tt.source, func(t *testing.T) {
ctx := v8.NewContext(iso)
defer ctx.Close()
Expand Down Expand Up @@ -694,7 +682,6 @@ func TestValueMarshalJSON(t *testing.T) {
}

for _, tt := range tests {

t.Run(tt.name, func(t *testing.T) {
ctx := v8.NewContext(iso)
defer ctx.Close()
Expand Down

0 comments on commit 746423c

Please sign in to comment.