All Projects → tj → Go Fixture

tj / Go Fixture

Licence: mit
Go assertions against test fixtures with nice line diffs, and an -update flag for updating fixture or "golden" files.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Fixture

Package fixture provides test assertions using test fixtures with nice line diffs, and an -update flag for bootstrapping & updating fixtures.

Example

func TestGenerate(t *testing.T) {
  // ... pretend we generate some client code here for TypeScript
  var act bytes.Buffer
  err = tsclient.Generate(&act)
  assert.NoError(t, err, "generating")

  // assert the contents of act.Bytes() to the test fixture ./testdata/client.ts
  fixture.Assert(t, "client.ts", act.Bytes())
}

GoDoc

Sponsors

This project is sponsored by CTO.ai, making it easy for development teams to create and share workflow automations without leaving the command line.

And my GitHub sponsors:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].