github.com/go-spring/spring-base@v1.1.3/assert/README.md (about)

     1  # assert
     2  
     3  Provides some useful assertion methods.
     4  
     5  ## Install
     6  
     7  ```
     8  go get github.com/go-spring/spring-base@v1.1.0-rc2 
     9  ```
    10  
    11  ## Import
    12  
    13  ```
    14  import "github.com/go-spring/spring-base/assert"
    15  ```
    16  
    17  ## Example
    18  
    19  ```
    20  assert.True(t, ok)
    21  assert.False(t, ok)
    22  assert.Nil(t, nil)
    23  assert.Equal(t, 0, "0")
    24  assert.NotEqual(t, "0", 0)
    25  assert.Same(t, 0, "0")
    26  assert.NotSame(t, "0", "0")
    27  assert.Panic(t, func() {}, "an error")
    28  assert.Matches(t, "there's no error", "an error")
    29  assert.Error(t, errors.New("there's no error"), "an error")
    30  assert.TypeOf(t, new(int), (*int)(nil))
    31  assert.Implements(t, errors.New("error"), (*error)(nil))
    32  ```