storj/private/context2/nocancel_test.go
Egon Elbre 08f63614be private/context2: add WithoutCancellation
Change-Id: I38557c16f41b8983886f256353cc6afb7634d9e6
2020-01-15 14:23:46 +02:00

27 lines
546 B
Go

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package context2_test
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"storj.io/common/testcontext"
"storj.io/storj/private/context2"
)
func TestWithoutCancellation(t *testing.T) {
ctx := testcontext.New(t)
defer ctx.Cleanup()
parent, cancel := context.WithCancel(ctx)
cancel()
without := context2.WithoutCancellation(parent)
require.Equal(t, error(nil), without.Err())
require.Equal(t, (<-chan struct{})(nil), without.Done())
}