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

Function TestPromise_Then

promise/promise_test.go:56–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestPromise_Then(t *testing.T) {
57 t.Parallel()
58
59 assert := internal.NewAssert(t, "TestPromise_Then")
60
61 p1 := New(func(resolve func(int), reject func(error)) {
62 resolve(1)
63 })
64
65 p2 := p1.Then(func(n int) int {
66 return n + 2
67 })
68
69 val, err := p1.Await()
70 assert.IsNil(err)
71 assert.Equal(1, val)
72
73 val, err = p2.Await()
74 assert.IsNil(err)
75 assert.Equal(3, val)
76}
77
78func TestCatch(t *testing.T) {
79 t.Parallel()

Callers

nothing calls this directly

Calls 6

IsNilMethod · 0.95
EqualMethod · 0.95
NewAssertFunction · 0.92
ThenMethod · 0.80
AwaitMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…