Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/pkg/expect

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/pkg/expect

  • v0.0.0-20191209053905-1fe4c9394a8a
  • Source
  • Go
  • Socket score

Version published
Created
Source

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

FAQs

Package last updated on 09 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc