github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/stdlib/utf8/utf8_test.go (about) 1 package utf8_test 2 3 import ( 4 "path/filepath" 5 "testing" 6 7 "github.com/hirochachacha/plua/compiler" 8 "github.com/hirochachacha/plua/runtime" 9 "github.com/hirochachacha/plua/stdlib/base" 10 "github.com/hirochachacha/plua/stdlib/string" 11 "github.com/hirochachacha/plua/stdlib/utf8" 12 ) 13 14 func TestUTF8(t *testing.T) { 15 c := compiler.NewCompiler() 16 17 matches, err := filepath.Glob("testdata/*.lua") 18 if err != nil { 19 t.Fatal(err) 20 } 21 22 for _, fname := range matches { 23 proto, err := c.CompileFile(fname, 0) 24 if err != nil { 25 t.Fatal(err) 26 } 27 28 p := runtime.NewProcess() 29 30 p.Require("_G", base.Open) 31 p.Require("utf8", utf8.Open) 32 p.Require("string", string.Open) 33 34 _, err = p.Exec(proto) 35 if err != nil { 36 t.Error(err) 37 } 38 } 39 }