Skip to content
/ expect Public

A simple assertion library that you probably shouldn't use.

License

Notifications You must be signed in to change notification settings

pkg/expect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expect Travis-CI GoDoc Report card Sourcegraph

A simple assertion library that you probably shouldn't use.

Quickstart

Package expect contains various test assertion helpers.

func TestOpenFile(t *testing.T) {
        f, err := os.Open("notfound")
        expect.Nil(err)
        err = f.Close()
        expect.True(err == nil)
}

expect helpers can be called from any function called from the main testing goroutine.

% go test
--- FAIL: TestOpenFile (0.00s)
    check_test.go:12: expected: <nil>, got: open notfound: no such file or directory

Consult the documentation for more information.

How does this work?

Magic

No, seriously, how does this work?

*testing.T is recovered dynamically from the call stack. Read the blog post.

License

BSD-2-Clause

About

A simple assertion library that you probably shouldn't use.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages