github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/utils/lists/match_test.go (about)

     1  package lists_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/lmorg/murex/test/count"
     7  	"github.com/lmorg/murex/utils/lists"
     8  )
     9  
    10  func TestMatch(t *testing.T) {
    11  	count.Tests(t, 3)
    12  
    13  	a := []string{"foo", "bar"}
    14  
    15  	if !lists.Match(a, "foo") {
    16  		t.Error("Did not match foo")
    17  	}
    18  
    19  	if !lists.Match(a, "bar") {
    20  		t.Error("Did not match bar")
    21  	}
    22  
    23  	if lists.Match(a, "foobar") {
    24  		t.Error("Incorrectly matched foobar")
    25  	}
    26  }