-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathassets_test.go
More file actions
44 lines (33 loc) · 740 Bytes
/
Copy pathassets_test.go
File metadata and controls
44 lines (33 loc) · 740 Bytes
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
33
34
35
36
37
38
39
40
41
42
43
44
package assets_test
import (
"io"
"testing"
"github.com/hedhyw/gherkingen/v4/internal/assets"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestTemplates(t *testing.T) {
t.Parallel()
names, err := assets.Templates()
if assert.NoError(t, err) {
assert.NotEmpty(t, names)
}
}
func TestOpenTemplate(t *testing.T) {
t.Parallel()
files := [...]string{
"std.simple.v1.go.tmpl",
}
for _, file := range files {
t.Run(file, func(t *testing.T) {
t.Parallel()
f, err := assets.OpenTemplate(file)
require.NoError(t, err)
defer func() { assert.NoError(t, f.Close()) }()
data, err := io.ReadAll(f)
if assert.NoError(t, err) {
assert.NotEmpty(t, data)
}
})
}
}