github.com/resonatecoop/id@v1.1.0-43/util/string_test.go (about)

     1  package util_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/resonatecoop/id/util"
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestStringInSlice(t *testing.T) {
    11  	assert.True(t, util.StringInSlice("a", []string{"a", "b", "c"}))
    12  
    13  	assert.False(t, util.StringInSlice("d", []string{"a", "b", "c"}))
    14  }
    15  
    16  func TestSpaceDelimitedStringNotGreater(t *testing.T) {
    17  	assert.True(t, util.SpaceDelimitedStringNotGreater("", "bar foo qux"))
    18  
    19  	assert.True(t, util.SpaceDelimitedStringNotGreater("foo", "bar foo qux"))
    20  
    21  	assert.True(t, util.SpaceDelimitedStringNotGreater("bar foo qux", "foo bar qux"))
    22  
    23  	assert.False(t, util.SpaceDelimitedStringNotGreater("foo bar qux bogus", "bar foo qux"))
    24  }