pkger/parser/parser_test.go

38 lines
589 B
Go
Raw Permalink Normal View History

2019-10-21 17:27:04 +03:00
package parser_test
2019-08-01 19:03:12 +03:00
import (
2019-10-21 17:27:04 +03:00
"fmt"
2019-08-02 00:35:42 +03:00
"sort"
2019-08-01 19:03:12 +03:00
"testing"
2019-10-21 17:27:04 +03:00
"github.com/markbates/pkger/parser"
2019-10-18 19:01:48 +03:00
"github.com/markbates/pkger/pkging/pkgtest"
2019-08-01 19:03:12 +03:00
"github.com/stretchr/testify/require"
)
2019-10-15 23:40:45 +03:00
func Test_Parser_App(t *testing.T) {
r := require.New(t)
2019-10-18 22:16:53 +03:00
app, err := pkgtest.App()
2019-10-15 23:40:45 +03:00
r.NoError(err)
2019-10-21 17:27:04 +03:00
res, err := parser.Parse(app.Info)
2019-10-15 23:40:45 +03:00
r.NoError(err)
2019-10-21 17:27:04 +03:00
files, err := res.Files()
r.NoError(err)
act := make([]string, len(files))
for i := 0; i < len(files); i++ {
act[i] = files[i].Path.String()
2019-10-15 23:40:45 +03:00
}
sort.Strings(act)
2019-10-21 17:27:04 +03:00
for _, a := range act {
fmt.Println(a)
}
2019-10-18 22:16:53 +03:00
r.Equal(app.Paths.Parser, act)
2019-10-15 23:40:45 +03:00
}