github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/util/generic/executable_filename_windows_test.go (about)

     1  //go:build windows
     2  // +build windows
     3  
     4  package generic_test
     5  
     6  import (
     7  	"fmt"
     8  	"path/filepath"
     9  
    10  	. "code.cloudfoundry.org/cli/util/generic"
    11  	. "github.com/onsi/ginkgo"
    12  	. "github.com/onsi/gomega"
    13  )
    14  
    15  var _ = Describe("ExecutableFilename", func() {
    16  	When("a filename which must be turned into an executable filename is input", func() {
    17  		It("appends .exe on Windows if it is not present", func() {
    18  			myPath := filepath.Join("foo", "bar")
    19  			Expect(ExecutableFilename(myPath)).To(Equal(fmt.Sprintf("%s.exe", myPath)))
    20  		})
    21  
    22  		It("doesn't append .exe on Windows if it is present", func() {
    23  			myPath := filepath.Join("foo", "bar.exe")
    24  			Expect(ExecutableFilename(myPath)).To(Equal(myPath))
    25  		})
    26  	})
    27  })