test

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: MIT Imports: 12 Imported by: 0

README

go-test

Open In GitPod GitHub code size in bytes GitHub commit activity GitHub last commit

collection of utility functions to help with testing go packages

Documentation

Overview

Package test is holds utility functions used for testing go packages acknowledgements :

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcurrentCases

func ConcurrentCases() []int

ConcurrentCases returns an array of integer which is used for number of cores when running concurrent benchmarks

func NewDeleteRequest

func NewDeleteRequest(endpoint string) (*http.Request, *httptest.ResponseRecorder)

NewDeleteRequest ...

func NewGetRequest

func NewGetRequest(endpoint string) (*http.Request, *httptest.ResponseRecorder)

NewGetRequest ...

func NewPostRequestWithBody

func NewPostRequestWithBody(endpoint string, body interface{}) (*http.Request, *httptest.ResponseRecorder)

NewPostRequestWithBody ...

func NewRandomReader

func NewRandomReader(blockSize int) io.Reader

NewRandomReader - make a new random stream generator random reader is used to generate random streams of bytes used for testing io operations https://github.com/ncw/stressdisk

Types

type CapturedStacktrace

type CapturedStacktrace string

CapturedStacktrace ...

func Stacktrace

func Stacktrace() CapturedStacktrace

Stacktrace - captures a stacktrace of the current goroutine github.com/hashicorp/go-hclog

type RWTestCase

type RWTestCase struct {
	Size                     int
	Unit                     int
	Expect                   []byte
	CustomWriteTester        func(t *testing.T, w Writer)
	CustomWriteToTester      func(t *testing.T, w WriterTo)
	CustomReaderWriterTester func(t *testing.T, r ReaderWriter)
}

RWTestCase define test cases used in testing Write([]byte) and Read([]byte) for unit , use values in primitives package

func GenerateRWTests

func GenerateRWTests() []RWTestCase

GenerateRWTests generates test for to help with testing io.writer and readers

type Reader

type Reader interface {
	Read(p []byte) (n int, err error)
	Len() int
}

Reader ...

type ReaderWriter

type ReaderWriter interface {
	Writer
	Read(p []byte) (n int, err error)
}

ReaderWriter ...

type Writer

type Writer interface {
	Write(p []byte) (int, error)
	Bytes() []byte
	Len() int
	Reset()
}

Writer ...

type WriterTo

type WriterTo interface {
	Writer
	WriteTo(w io.Writer) (int64, error)
}

WriterTo ...

Jump to

Keyboard shortcuts

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