github.com/nimakaviani/cli@v6.37.1-0.20180619223813-e734901a73fa+incompatible/util/url_test.go (about) 1 package util_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/util" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/ginkgo/extensions/table" 8 . "github.com/onsi/gomega" 9 ) 10 11 var _ = Describe("util", func() { 12 13 DescribeTable("URL's", 14 func(path string, isHTTPScheme bool) { 15 Expect(IsHTTPScheme(path)).To(Equal(isHTTPScheme)) 16 }, 17 18 Entry("proper HTTP URL", "http://example.com", true), 19 Entry("proper HTTPS URL", "https://example.com", true), 20 Entry("not proper HTTP URL", "http//example.com", false), 21 Entry("proper FTP URL", "ftp://example.com", false), 22 Entry("local file name", "some-path", false), 23 Entry("UNIX path", "/some/path", false), 24 Entry("Windows path", "C:\\some\\path", false), 25 ) 26 27 DescribeTable("IsUnsupportedScheme", 28 func(path string, isUnsupportedScheme bool) { 29 Expect(IsUnsupportedURLScheme(path)).To(Equal(isUnsupportedScheme)) 30 }, 31 32 Entry("proper HTTP URL", "http://example.com", false), 33 Entry("proper HTTPS URL", "https://example.com", false), 34 Entry("not proper HTTP URL", "http//example.com", false), 35 Entry("proper FTP URL", "ftp://example.com", true), 36 Entry("local file name", "some-path", false), 37 Entry("UNIX path", "/some/path", false), 38 Entry("Windows path", "C:\\some\\path", false), 39 ) 40 })