8000 GitHub - wreulicke/snap: Snapshot testing for Go / Golden file testing for Go
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wreulicke/snap

Repository files navigation

snap

Snap is snapshot testing library.

Install

go get github.com/wreulicke/snap

Usage

You can update snapshots via go test ./... -update.

Examples

func TestSnapshot(t *testing.T) {
	s := New()
	_ = s.Snapshot("xxx")
	_ = s.Snapshot("xxx")
	_ = s.Snapshot("xxxy")
	s.Assert(t)
}

func TestSnapshotBytes(t *testing.T) {
	s := New()
	_ = s.SnapshotBytes([]byte("吉野家"))
	s.Assert(t)
}

func TestCanUseAsIoWriter(t *testing.T) {
	s := New()
	b := bytes.NewBufferString("test")
	_, _ = io.Copy(s, b)
	s.Assert(t)
}

Related Projects

About

Snapshot testing for Go / Golden file testing for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
0