From 7c4bf4708088e7e922a708bd422a65b3d47849a5 Mon Sep 17 00:00:00 2001 From: Devin Singh Date: Tue, 15 Jun 2021 13:32:16 -0500 Subject: [PATCH] test: use testmain for setup stuff --- shell_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell_test.go b/shell_test.go index 08d879f..a3a7ed8 100644 --- a/shell_test.go +++ b/shell_test.go @@ -7,9 +7,12 @@ import ( "testing" ) +func TestMain(m *testing.M) { + LuaInit() +} + // https://stackoverflow.com/questions/10473800/in-go-how-do-i-capture-stdout-of-a-function-into-a-string func TestRunInputSh(t *testing.T) { - LuaInit() cmd := "echo 'hello'" old := os.Stdout // keep backup of the real stdout r, w, _ := os.Pipe() @@ -36,7 +39,6 @@ func TestRunInputSh(t *testing.T) { } func TestRunInputLua(t *testing.T) { - LuaInit() cmd := "print('hello')" old := os.Stdout // keep backup of the real stdout r, w, _ := os.Pipe()