api

package
v0.0.0-...-549aca6 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: BSD-2-Clause Imports: 29 Imported by: 0

Documentation

Overview

Package api is a collection of open source golang projects repurposed or simplified into goFish functions and/or packages

Assertions source code was taken from https://github.com/stretchr/testify/tree/master/assert

Assertions allow you to easily write test code, and are global funcs in the `assert` package. All assertion functions take, as the first argument, the `*testing.T` object provided by the testing framework. This allows the assertion funcs to write the failings and other details to the correct place.

Every assertion function also takes an optional string message as the final argument, allowing custom error messages to be appended to the message the assertion method outputs.

Sample storage-quickstart creates a Google Cloud Storage bucket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallerInfo

func CallerInfo() []string

CallerInfo returns an array of strings containing the file and line number of each stack frame leading from the current test to the assert call that failed.

func Equal

func Equal(t *testing.T, val1, val2 interface{})

Equal validates that val1 is equal to val2 and throws an error with line number

func Fail

func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool

Fail reports a failure through

func False

func False(t TestingT, value bool, msgAndArgs ...interface{}) bool

False asserts that the specified value is false.

assert.False(t, myBool)

func InDelta

func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool

InDelta asserts that the two numerals are within delta of each other.

InDelta(t, math.Pi, 22/7.0, 0.01)

func Kernels

func Kernels()

func Len

func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool

func NewPool

func NewPool(size int) *ants.Pool

func Nil

func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool

Nil asserts that the specified object is nil.

assert.Nil(t, err)

func NotEqual

func NotEqual(t *testing.T, val1, val2 interface{})

NotEqual validates that val1 is not equal val2 and throws an error with line number

func NotNil

func NotNil(t *testing.T, w interface{})

func OpenDirectory

func OpenDirectory(dir string)

func ScatterChart

func ScatterChart(filename string, x, y []float64)

func True

func True(t TestingT, value bool, msgAndArgs ...interface{}) bool

True asserts that the specified value is true.

assert.True(t, myBool)

Types

type Bash

type Bash struct {
	cmd.Command
}

Bash struct implements the commander-cli/cmd which can be found at: https://github.com/commander-cli/cmd/blob/master/command.go

func NewScript

func NewScript(script string) *Bash

New script calles the new command method inherited by commander-cli

func (*Bash) Run

func (sh *Bash) Run()

Run executes the command line script

func (*Bash) Stderr

func (sh *Bash) Stderr() string

Stderr returns the output to stderr

func (*Bash) Stdout

func (sh *Bash) Stdout() string

Stdout returns the output to stdout

type BoolAssertionFunc

type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool

BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful for table driven tests.

type Comparison

type Comparison func() (success bool)

Comparison is a custom function that returns true on success and false on failure

type ComparisonAssertionFunc

type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool

ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful for table driven tests.

type Dumper

type Dumper struct {
	N, M, W, H, Cnt int
	S               *svg.SVG
	I               *image.RGBA
	// contains filtered or unexported fields
}

func NewDumper

func NewDumper(name string, n, m, w, h int) *Dumper

func (*Dumper) Close

func (d *Dumper) Close()

func (*Dumper) Plot

func (d *Dumper) Plot(c chart.Chart)

type ErrorAssertionFunc

type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool

ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful for table driven tests.

type TestingT

type TestingT interface {
	Errorf(format string, args ...interface{})
}

TestingT is an interface wrapper around *testing.T

type ValueAssertionFunc

type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool

ValueAssertionFunc is a common function prototype when validating a single value. Can be useful for table driven tests.

Jump to

Keyboard shortcuts

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