blob: 0a6b7c07b949e2d48c2497d94c1237b1b8dac34d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package stmutil
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestContextEquality(t *testing.T) {
ctx := context.Background()
assert.True(t, ctx == context.Background())
childCtx, cancel := context.WithCancel(ctx)
assert.True(t, childCtx != ctx)
assert.True(t, childCtx != ctx)
assert.Equal(t, context.Background(), ctx)
cancel()
assert.Equal(t, context.Background(), ctx)
assert.NotEqual(t, ctx, childCtx)
}
|