package write import ( "context" _ "embed" "os" "strings" "testing" "edge-infra.dev/test/f2" "gotest.tools/v3/assert" ) // text file generated in the BUILD.bazel file // hey.txt -- is generated by write_source_files and is checked in to git // //go:embed testdata/hey.txt var testdata []byte var f f2.Framework func TestMain(m *testing.M) { f = f2.New(context.Background()) os.Exit(f.Run(m)) } func TestWriiteSourceFileDataEmbed(t *testing.T) { fin := f2.NewFeature("write source file data embed feature"). Test("test write source file data", func(ctx f2.Context, t *testing.T) f2.Context { t.Log("testdata", "---", string(testdata), "---") assert.Equal(t, strings.TrimSpace(string(testdata)), "created by write_source_file rule") return ctx }).Feature() f.Test(t, fin) }