MCPcopy
hub / github.com/duke-git/lancet / TestAfter

Function TestAfter

function/function_test.go:13–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestAfter(t *testing.T) {
14 t.Parallel()
15
16 arr := []string{"a", "b"}
17 f := After(len(arr), func(i int) int {
18 fmt.Println("print done")
19 return i
20 })
21 type cb func(args ...any) []reflect.Value
22 print := func(i int, s string, fn cb) {
23 fmt.Printf("print: arr[%d] is %s \n", i, s)
24 v := fn(i)
25 if v != nil {
26 vv := v[0].Int()
27 if vv != 1 {
28 t.FailNow()
29 }
30 }
31 }
32 fmt.Println("print: arr is", arr)
33 for i := 0; i < len(arr); i++ {
34 print(i, arr[i], f)
35 }
36}
37
38func TestBefore(t *testing.T) {
39 t.Parallel()

Callers

nothing calls this directly

Calls 1

AfterFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…