From f9245a82097f3ddd52ce6031111e2a457e1a4f8e Mon Sep 17 00:00:00 2001 From: Micael Santana Date: Tue, 27 Sep 2022 13:47:32 -0300 Subject: [PATCH] wip: wanna check runtimeError type within if codition --- auxiliary_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/auxiliary_test.go b/auxiliary_test.go index fb488b5..5c66d98 100644 --- a/auxiliary_test.go +++ b/auxiliary_test.go @@ -1,6 +1,9 @@ package lua -import "testing" +import ( + "errors" + "testing" +) func TestLoadFileSyntaxError(t *testing.T) { l := NewState() @@ -36,4 +39,15 @@ func TestLoadStringSyntaxError(t *testing.T) { if estr != "[string \"this_is_a_syntax_error\"]:1: syntax error near " { t.Error("didn't push the correct error string") } + +} + +func TestLoadFileRuntimeError(t *testing.T) { + l := NewState() + err := LoadFile(l, "fixtures/runtime_error.lua", "") + + target := RuntimeError("") + if errors.As(err, &target) != true { + t.Error("didn't return RuntimeError on file with runtime error") + } }