...
1 package write
2
3 import (
4 "context"
5 _ "embed"
6 "os"
7 "strings"
8 "testing"
9
10 "edge-infra.dev/test/f2"
11 "gotest.tools/v3/assert"
12 )
13
14
15
16
17
18 var testdata []byte
19
20 var f f2.Framework
21
22 func TestMain(m *testing.M) {
23 f = f2.New(context.Background())
24 os.Exit(f.Run(m))
25 }
26
27 func TestWriiteSourceFileDataEmbed(t *testing.T) {
28 fin := f2.NewFeature("write source file data embed feature").
29 Test("test write source file data", func(ctx f2.Context, t *testing.T) f2.Context {
30
31 t.Log("testdata", "---", string(testdata), "---")
32 assert.Equal(t, strings.TrimSpace(string(testdata)), "created by write_source_file rule")
33
34 return ctx
35 }).Feature()
36
37 f.Test(t, fin)
38 }
39
View as plain text