contexttest

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

contexttest

Build Status codecov golangci GoDoc goreadme

Package contexttest is a collection of tests for context implementations.

The standard library, alongside a context interface, provides context implementation which gives the context implementation a behavior, such as a perceived immutability of the context object, safe concurrent access and cancel propagation.

This package gathers testing functions for context implementations in order to make sure that they follow the standard library behavior.

Usage

See example in ./standardlib_test.go.

Functions

func TestWithCancel

func TestWithCancel(wc WithCancel) func(t *testing.T)

TestWithCancel tests the behavior of a context.WithCancel function.

func TestWithDeadline

func TestWithDeadline(withDeadline WithDeadline) func(t *testing.T)

TestWithDeadline tests the behavior of a context.WithDeadline function.

func TestWithTimeout

func TestWithTimeout(withTimeout WithTimeout) func(t *testing.T)

TestWithTimeout tests the behavior of a context.WithTimeout function.

func TestWithValue

func TestWithValue(wv WithValue) func(t *testing.T)

TestWithValue tests the behavior of a context.WithValue function.


Created by goreadme

Documentation

Overview

Package contexttest is a collection of tests for context implementations.

The standard library, alongside a context interface, provides context implementation which gives the context implementation a behavior, such as a perceived immutability of the context object, safe concurrent access and cancel propagation.

This package gathers testing functions for context implementations in order to make sure that they follow the standard library behavior.

Usage

See example in ./standardlib_test.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestWithCancel

func TestWithCancel(wc WithCancel) func(t *testing.T)

TestWithCancel tests the behavior of a context.WithCancel function.

func TestWithDeadline

func TestWithDeadline(withDeadline WithDeadline) func(t *testing.T)

TestWithDeadline tests the behavior of a context.WithDeadline function.

func TestWithTimeout

func TestWithTimeout(withTimeout WithTimeout) func(t *testing.T)

TestWithTimeout tests the behavior of a context.WithTimeout function.

func TestWithValue

func TestWithValue(wv WithValue) func(t *testing.T)

TestWithValue tests the behavior of a context.WithValue function.

Types

type WithCancel

type WithCancel func(ctx context.Context) (context.Context, context.CancelFunc)

WithCancel can be tested to have the behavior of context.WithCancel.

type WithDeadline

type WithDeadline func(ctx context.Context, deadline time.Time) (context.Context, context.CancelFunc)

WithDeadline can be tested to have the behavior of context.WithDeadline.

type WithTimeout

type WithTimeout func(ctx context.Context, duration time.Duration) (context.Context, context.CancelFunc)

WithTimeout can be tested to have the behavior of context.WithTimeout.

type WithValue

type WithValue func(ctx context.Context, key, val interface{}) context.Context

WithValue can be tested to have the behavior of context.WithValue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL