Giter VIP home page Giter VIP logo

assert's Introduction

I generally love working on systems problems, from virtualization to distributed systems, and more recently, ML problems. Learn more about me at my website.

See you soon!

-- Aaron

assert's People

Contributors

arschles avatar krancour avatar technosophos avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

assert's Issues

Create an interface that allows people to write custom equal checking functions

The official Go FAQ outlines an Equaler interface that looks like this:

type Equaler interface {
    Equal(Equaler) bool
}

This library should provide that interface and check for it in assert.Equals calls. If both arguments are Equaler implementations, it should call expected.Equal(actual) instead of using reflect.DeepEqual.

This feature would allow people to write custom equality checks for use in tests and otherwise. It would help especially with testing equality on complex types like deeply nested structs or pointers.

Add some functions for dealing with table-driven tests

It often doesn't make sense to fail a test because one iteration of a loop failed in a table driven test. It would be helpful to have some construct that you can create before the loop starts, report errors during iteration (concurrency safe) and then check afterward. Usage like this would be nice:

func TestExamples(t *testing.T) {
  loopChecker := assert.NewLoop()
  for exampleNum, exampleFunc := range examplesMap {
    // True() calls exampleFunc and returns its value. It calls t.Errorf if it returned false
    if !loopChecker.True(t, exampleNum, exampleFunc()) {
      continue
    }
  }
}
// ReportFatal() calls t.Fatalf if any errors were reported in the loop
loopChecker.ReportFatal(t, "examples")

README has a few typos

The examples in the README suggest that you call functions like assert.NoErr(err), when it should be assert.NoErr(t, err).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.