...

Source file src/github.com/theupdateframework/go-tuf/internal/sets/strings_test.go

Documentation: github.com/theupdateframework/go-tuf/internal/sets

     1  package sets
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestStringSliceToSet(t *testing.T) {
    10  	assert.Equal(t,
    11  		map[string]struct{}{
    12  			"a": {},
    13  			"b": {},
    14  			"c": {},
    15  		},
    16  		StringSliceToSet([]string{"a", "c", "b", "c", "b"}))
    17  }
    18  
    19  func TestStringSetToSlice(t *testing.T) {
    20  	assert.ElementsMatch(t,
    21  		[]string{"a", "b", "c"},
    22  		StringSetToSlice(map[string]struct{}{
    23  			"a": {},
    24  			"b": {},
    25  			"c": {},
    26  		}),
    27  	)
    28  }
    29  
    30  func TestDeduplicateStrings(t *testing.T) {
    31  	assert.ElementsMatch(t,
    32  		[]string{"a", "b", "c"},
    33  		DeduplicateStrings([]string{"a", "c", "b", "c", "b"}),
    34  	)
    35  }
    36  

View as plain text