Skip to content

Commit

Permalink
Write test case for return err that was not covered
Browse files Browse the repository at this point in the history
  • Loading branch information
wisepythagoras committed Oct 16, 2021
1 parent 1bc4f79 commit a6ffe11
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,17 @@ func TestObjectPrivateProperties(t *testing.T) {
defer ctx.Close()

tmpl := v8.NewObjectTemplate(iso)
obj, _ := tmpl.NewInstance(ctx)
err := obj.SetInternal(0, "This should fail")

if err == nil {
t.Errorf("Setting an internal field without calling SetInternalFieldCount should fail")
}

tmpl = v8.NewObjectTemplate(iso)
tmpl.SetInternalFieldCount(1)

obj, _ := tmpl.NewInstance(ctx)
obj, _ = tmpl.NewInstance(ctx)

obj.SetInternal(0, "baz")
v, err := obj.GetInternal(0)
Expand Down

0 comments on commit a6ffe11

Please sign in to comment.