github.com/loafoe/cli@v7.1.0+incompatible/integration/helpers/matchers.go (about)

     1  package helpers
     2  
     3  import (
     4  	"fmt"
     5  	"regexp"
     6  	"runtime"
     7  
     8  	"github.com/onsi/gomega/gbytes"
     9  	"github.com/onsi/gomega/types"
    10  )
    11  
    12  // SayPath is used to assert that a path is printed within streaming output.
    13  // On Windows, it uses a case-insensitive match and escapes the path.
    14  func SayPath(format string, path string) types.GomegaMatcher {
    15  	if runtime.GOOS == "windows" {
    16  		expected := "(?i)" + format
    17  		expected = fmt.Sprintf(expected, regexp.QuoteMeta(path))
    18  		return gbytes.Say(expected)
    19  	}
    20  	return gbytes.Say(format, path)
    21  }