...
1 package simple
2
3 import (
4 "context"
5 "fmt"
6 "os"
7 "testing"
8
9 "gotest.tools/v3/assert"
10
11 "edge-infra.dev/test/f2"
12 )
13
14 var f f2.Framework
15
16 func Hey(name string) string {
17 return fmt.Sprintf("Hey %s", name)
18 }
19
20 func TestMain(m *testing.M) {
21 f = f2.New(context.Background())
22
23 os.Exit(f.Run(m))
24 }
25
26 func TestSimpleFeature(t *testing.T) {
27 fin := f2.NewFeature("hello feature").
28 Test("test hey", func(ctx f2.Context, t *testing.T) f2.Context {
29 assert.Equal(t, "Hey foo", Hey("foo"))
30
31 return ctx
32 }).Feature()
33
34 f.Test(t, fin)
35 }
36
View as plain text