From e8c4d2bd90260cea7b131326069909c6e45ec8de Mon Sep 17 00:00:00 2001 From: Genevieve L'Esperance Date: Thu, 2 Sep 2021 11:24:14 -0700 Subject: [PATCH] Use getter to vet error handling in C.ObjectGet - Add back test for methodcall on not-a-function --- object_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/object_test.go b/object_test.go index 21dd8bd3..cd205d26 100644 --- a/object_test.go +++ b/object_test.go @@ -22,14 +22,18 @@ func TestObjectMethodCall(t *testing.T) { if val.String() != "some val" { t.Errorf("unexpected value: %q", val) } + _, err = obj.MethodCall("prop") + if err == nil { + t.Errorf("expected an error, got none") + } - val, err = ctx.RunScript(`class Obj2 { print(str) { return str.toString() } }; new Obj2()`, "") + val, err = ctx.RunScript(`class Obj2 { print(str) { return str.toString() }; get fails() { throw "error" } }; new Obj2()`, "") failIf(t, err) obj, _ = val.AsObject() arg, _ := v8go.NewValue(ctx.Isolate(), "arg") _, err = obj.MethodCall("print", arg) failIf(t, err) - _, err = obj.MethodCall("notamethod") + _, err = obj.MethodCall("fails") if err == nil { t.Errorf("expected an error, got none") }