github.com/rjgonzale/pop/v5@v5.1.3-dev/internal/defaults/defaults_test.go (about)

     1  package defaults
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func Test_String(t *testing.T) {
    10  	a := assert.New(t)
    11  
    12  	a.Equal(String("", "foo"), "foo")
    13  	a.Equal(String("bar", "foo"), "bar")
    14  	var s string
    15  	a.Equal(String(s, "foo"), "foo")
    16  }
    17  
    18  func Test_Int(t *testing.T) {
    19  	a := assert.New(t)
    20  
    21  	a.Equal(Int(0, 1), 1)
    22  	a.Equal(Int(2, 1), 2)
    23  	var s int
    24  	a.Equal(Int(s, 1), 1)
    25  }
    26  
    27  func Test_Int64(t *testing.T) {
    28  	a := assert.New(t)
    29  
    30  	a.Equal(Int64(0, 1), int64(1))
    31  	a.Equal(Int64(2, 1), int64(2))
    32  	var s int64
    33  	a.Equal(Int64(s, 1), int64(1))
    34  }
    35  
    36  func Test_Float32(t *testing.T) {
    37  	a := assert.New(t)
    38  
    39  	a.Equal(Float32(0, 1), float32(1))
    40  	a.Equal(Float32(2, 1), float32(2))
    41  	var s float32
    42  	a.Equal(Float32(s, 1), float32(1))
    43  }
    44  
    45  func Test_Float64(t *testing.T) {
    46  	a := assert.New(t)
    47  
    48  	a.Equal(Float64(0, 1), float64(1))
    49  	a.Equal(Float64(2, 1), float64(2))
    50  	var s float64
    51  	a.Equal(Float64(s, 1), float64(1))
    52  }