mirror of https://github.com/Hilbis/Hilbish
test: use testmain for setup stuff
parent
8315dd5e70
commit
7c4bf47080
|
@ -7,9 +7,12 @@ import (
|
||||||
"testing"
|
"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
|
// https://stackoverflow.com/questions/10473800/in-go-how-do-i-capture-stdout-of-a-function-into-a-string
|
||||||
func TestRunInputSh(t *testing.T) {
|
func TestRunInputSh(t *testing.T) {
|
||||||
LuaInit()
|
|
||||||
cmd := "echo 'hello'"
|
cmd := "echo 'hello'"
|
||||||
old := os.Stdout // keep backup of the real stdout
|
old := os.Stdout // keep backup of the real stdout
|
||||||
r, w, _ := os.Pipe()
|
r, w, _ := os.Pipe()
|
||||||
|
@ -36,7 +39,6 @@ func TestRunInputSh(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunInputLua(t *testing.T) {
|
func TestRunInputLua(t *testing.T) {
|
||||||
LuaInit()
|
|
||||||
cmd := "print('hello')"
|
cmd := "print('hello')"
|
||||||
old := os.Stdout // keep backup of the real stdout
|
old := os.Stdout // keep backup of the real stdout
|
||||||
r, w, _ := os.Pipe()
|
r, w, _ := os.Pipe()
|
||||||
|
|
Loading…
Reference in New Issue