File: gluare_test.go

package info (click to toggle)
golang-github-yuin-gluare 0.0~git20170607.d7c94f1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 84 kB
  • sloc: makefile: 3
file content (32 lines) | stat: -rw-r--r-- 649 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package gluare

import (
	"fmt"
	"github.com/yuin/gopher-lua"
	"os"
	"testing"
)

func testScriptDir(t *testing.T, tests []string, directory string) {
	if err := os.Chdir(directory); err != nil {
		t.Error(err)
	}
	defer os.Chdir("..")
	for _, script := range tests {
		fmt.Printf("testing %s/%s\n", directory, script)
		L := lua.NewState(lua.Options{
			RegistrySize:        1024 * 20,
			CallStackSize:       1024,
			IncludeGoStackTrace: true,
		})
		L.PreloadModule("re", Loader)
		if err := L.DoFile(script); err != nil {
			t.Error(err)
		}
		L.Close()
	}
}

func TestGluaRe(t *testing.T) {
	testScriptDir(t, []string{"test.lua"}, "_tests")
}