github.com/sleungcy-sap/cli@v7.1.0+incompatible/util/generic/executable_filename_windows_test.go (about)

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