gospel: github.com/r7kamura/gospel Index | Files

package gospel

import "github.com/r7kamura/gospel"

Index

Package Files

dsl.go example.go example_group.go expectation.go formatter.go

func After Uses

func After(filter func())

func Before Uses

func Before(filter func())

func Context Uses

func Context(description string, callback func())

func Describe Uses

func Describe(t *testing.T, description string, callback func())

func Equal Uses

func Equal(values ...interface{}) (failureMessage string)

Checks if actual == expected.

func Exist Uses

func Exist(values ...interface{}) (failureMessage string)

Checks if actual != nil.

func It Uses

func It(message string, evaluator func())

func NotEqual Uses

func NotEqual(values ...interface{}) (failureMessage string)

Checks if actual != expected.

func NotExist Uses

func NotExist(values ...interface{}) (failureMessage string)

Checks if actual == nil.

type DocumentFormatter Uses

type DocumentFormatter struct{}

func (*DocumentFormatter) Failed Uses

func (formatter *DocumentFormatter) Failed(example *Example, message string)

func (*DocumentFormatter) Started Uses

func (formatter *DocumentFormatter) Started(example *Example)

func (*DocumentFormatter) Succeeded Uses

func (formatter *DocumentFormatter) Succeeded(example *Example)

type DotFormatter Uses

type DotFormatter struct{}

func (*DotFormatter) Failed Uses

func (formatter *DotFormatter) Failed(example *Example, message string)

func (*DotFormatter) Started Uses

func (formatter *DotFormatter) Started(example *Example)

Does nothing.

func (*DotFormatter) Succeeded Uses

func (formatter *DotFormatter) Succeeded(example *Example)

type Example Uses

type Example struct {
    *ExampleGroup
    Message    string
    Evaluator  func()
    HasFailure bool
    Formatter
}

func It() creates a new Example object.

func (*Example) Descriptions Uses

func (example *Example) Descriptions() []string

Returns its ExamplesGroups' descriptions as an array of string.

func (*Example) Evaluate Uses

func (example *Example) Evaluate()

Invokes its Evaluator function.

func (*Example) Failed Uses

func (example *Example) Failed(message string)

Called when any of expectations failed.

func (*Example) FullDescription Uses

func (example *Example) FullDescription() string

Returns its entire descriptions + message as a string.

func (*Example) Run Uses

func (example *Example) Run()

func It() calls this function to run the newly created example.

func (*Example) Started Uses

func (example *Example) Started()

Called when started.

func (*Example) Succeeded Uses

func (example *Example) Succeeded()

Called when all of expectations passed.

type ExampleGroup Uses

type ExampleGroup struct {
    *testing.T
    Parent        *ExampleGroup
    Description   string
    Result        string
    BeforeFilters []func()
    AfterFilters  []func()
}

Describe or Context creates this object.

func (*ExampleGroup) Ancestors Uses

func (group *ExampleGroup) Ancestors() []*ExampleGroup

Returns its ancestor ExampleGroups in ascending order according to distance.

func (*ExampleGroup) PrintResult Uses

func (group *ExampleGroup) PrintResult()

In non-verbose mode, we print test results for each Describe.

func (*ExampleGroup) ReverseAncestors Uses

func (group *ExampleGroup) ReverseAncestors() []*ExampleGroup

Returns its ancestor ExampleGroups in descending order according to distance.

func (*ExampleGroup) ReverseAncestorsAndSelf Uses

func (group *ExampleGroup) ReverseAncestorsAndSelf() []*ExampleGroup

Merges its ancestors and itself.

func (*ExampleGroup) Root Uses

func (group *ExampleGroup) Root() *ExampleGroup

Gets root ExampleGroup defined by Describe func.

func (*ExampleGroup) RunAfterFilters Uses

func (group *ExampleGroup) RunAfterFilters()

Runs all AfterFilters defined to its ancestors and itself.

func (*ExampleGroup) RunBeforeFilters Uses

func (group *ExampleGroup) RunBeforeFilters()

Runs all BeforeFilters defined to its ancestors and itself.

type Expectation Uses

type Expectation struct {
    *Example
    Actual interface{}
}

func Expect() creates a new Expectation object.

func Expect Uses

func Expect(actual interface{}) *Expectation

func (*Expectation) To Uses

func (expectation *Expectation) To(matcher Matcher, expected ...interface{})

Checks if a given matcher satisfies actual & optional values.

type Formatter Uses

type Formatter interface {
    Started(*Example)
    Failed(*Example, string)
    Succeeded(*Example)
}

type Matcher Uses

type Matcher func(...interface{}) string

Returns a non-empty failure message if given actual & optional values are not matched.

Package gospel imports 7 packages (graph). Updated 2016-07-30. Refresh now. Tools for package owners.