项目作者: hooklift

项目描述 :
Minimalist assertion library for Go
高级语言: Go
项目地址: git://github.com/hooklift/assert.git
创建时间: 2015-02-10T15:38:04Z
项目社区:https://github.com/hooklift/assert

开源协议:Mozilla Public License 2.0

下载


Minimalistic assertion library

Installation

go get -u github.com/hooklift/assert

Usage

  1. package blah
  2. import (
  3. "testing"
  4. "github.com/hooklift/assert"
  5. )
  6. func TestSave(t *testing.T) {
  7. u := &Account{
  8. repo: &RepoMock{},
  9. Email: "camilo@hooklift.io",
  10. Password: "mypassword",
  11. Name: "Camilo Aguilar",
  12. }
  13. err := u.Save()
  14. assert.Ok(t, err)
  15. assert.Cond(t, u.ID != "", "User ID should not be empty: %v", u)
  16. u2, err := Get(u.ID)
  17. assert.Ok(t, err)
  18. assert.Equals(t, u.ID, u2.ID)
  19. }