Skip to content
A simple assertion library that you probably shouldn't use.
Go
Branch: master
Clone or download
davecheney .travis.yml: test against 1.13 and tip
Signed-off-by: Dave Cheney <dave@cheney.net>
Latest commit 1fe4c93 Dec 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml .travis.yml: test against 1.13 and tip Dec 9, 2019
LICENSE Initial commit Dec 8, 2019
README.md Initial commit Dec 8, 2019
expect.go
go.mod Initial commit Dec 8, 2019
t.go Initial commit Dec 8, 2019
t_test.go

README.md

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

You can’t perform that action at this time.