github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/providers/security/filesec/util_test.go (about)

     1  // Copyright (c) 2020-2022, R.I. Pienaar and the Choria Project contributors
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package filesec
     6  
     7  import (
     8  	. "github.com/onsi/ginkgo/v2"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("MatchAnyRegex", func() {
    13  	It("Should correctly match valid patterns", func() {
    14  		patterns := []string{
    15  			"bare",
    16  			"/this.+other/",
    17  		}
    18  
    19  		Expect(MatchAnyRegex("this is a bare word sentence", patterns)).To(BeTrue())
    20  		Expect(MatchAnyRegex("this, that and the other", patterns)).To(BeTrue())
    21  		Expect(MatchAnyRegex("no match", patterns)).To(BeFalse())
    22  	})
    23  })