github.com/RevenueMonster/sqlike@v1.0.6/sqlike/options/modify_one_test.go (about)

     1  package options
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func TestModifyOneOptions(t *testing.T) {
    10  	opt := ModifyOne()
    11  
    12  	t.Run("SetDebug", func(it *testing.T) {
    13  		{
    14  			opt.SetDebug(true)
    15  			require.True(it, opt.Debug)
    16  		}
    17  
    18  		{
    19  			opt.SetDebug(false)
    20  			require.False(it, opt.Debug)
    21  		}
    22  	})
    23  
    24  	t.Run("SetOmitFields", func(it *testing.T) {
    25  		opt.SetOmitFields("A", "cc")
    26  		require.ElementsMatch(it, []string{"A", "cc"}, opt.Omits)
    27  	})
    28  
    29  	t.Run("SetStrict", func(it *testing.T) {
    30  		opt.SetStrict(true)
    31  		require.False(it, opt.NoStrict)
    32  
    33  		opt.SetStrict(false)
    34  		require.True(it, opt.NoStrict)
    35  	})
    36  }