Documentation
¶
Overview ¶
Package be_url provides Be matchers on url.URL
Index ¶
- Variables
- func HavingHost(args ...any) types.BeMatcher
- func HavingHostname(args ...any) types.BeMatcher
- func HavingMultipleSearchParam(searchParamName string, args ...any) types.BeMatcher
- func HavingPassword(args ...any) types.BeMatcher
- func HavingPath(args ...any) types.BeMatcher
- func HavingPort(args ...any) types.BeMatcher
- func HavingRawQuery(args ...any) types.BeMatcher
- func HavingScheme(args ...any) types.BeMatcher
- func HavingSearchParam(searchParamName string, args ...any) types.BeMatcher
- func HavingUserinfo(args ...any) types.BeMatcher
- func HavingUsername(args ...any) types.BeMatcher
- func NotHavingPort(args ...any) types.BeMatcher
- func NotHavingScheme(args ...any) types.BeMatcher
- func URL(args ...any) types.BeMatcher
- func WithHttp() types.BeMatcher
- func WithHttps() types.BeMatcher
Constants ¶
This section is empty.
Variables ¶
var TransformSchemelessUrlFromString = func(rawURL string) (*url.URL, error) { result, err := url.Parse(rawURL) if err == nil && result.Scheme == "" { result, err = url.Parse("http://" + rawURL) if err == nil { result.Scheme = "" } } return result, err }
TransformSchemelessUrlFromString returns string->*url.Url transform It allows string to be a scheme-less url
var TransformUrlFromString = url.Parse
TransformUrlFromString returns string->*url.Url transform
Functions ¶
func HavingHost ¶
HavingHost succeeds if the actual value is a *url.URL and its Host matches the provided one (via direct value or matchers)
func HavingHostname ¶
HavingHostname succeeds if the actual value is a *url.URL and its Hostname matches the provided one (via direct value or matchers)
func HavingMultipleSearchParam ¶
HavingMultipleSearchParam succeeds if the actual value is a *url.URL and its specified search parameter (all its values via slice) matches the provided arguments.
func HavingPassword ¶
HavingPassword succeeds if the actual value is a *url.URL and its Password matches the provided one.
func HavingPath ¶
HavingPath succeeds if the actual value is a *url.URL and its Path matches the given one.
func HavingPort ¶
HavingPort succeeds if the actual value is a *url.URL and its Port matches the provided one.
func HavingRawQuery ¶
HavingRawQuery succeeds if the actual value is a *url.URL and its RawQuery matches the given one.
func HavingScheme ¶
HavingScheme succeeds if the actual value is a *url.URL and its Scheme matches the provided one (via direct value or matchers)
func HavingSearchParam ¶
HavingSearchParam succeeds if the actual value is a *url.URL and its specified search parameter matches the provided arguments.
func HavingUserinfo ¶
HavingUserinfo succeeds if the actual value is a *url.URL and its User.String() matches the provided one.
func HavingUsername ¶
HavingUsername succeeds if the actual value is a *url.URL and its Username matches the provided one.
func NotHavingPort ¶
NotHavingPort succeeds if the actual value is a *url.URL and its Port does not match the given one. Example: `Expect(u).To(NotHavingPort())` matches port-less url
func NotHavingScheme ¶
NotHavingScheme succeeds if the actual value is a *url.URL and its Scheme negatively matches given value Example: `Expect(u).To(NotHavingScheme())` matches url without a scheme
func URL ¶
URL matches actual value to be a valid URL corresponding to given inputs Possible inputs: 1. Nil args -> so actual value MUST be any valid *url.URL 2. Single arg <string>. Actual value MUST be a *url.URL, whose .String() compared against args[0] 3. Single arg <*url.Url>. Actual value MUST be a *url.URL, whose .String() compared against args[0].String() 4. List of Omega/Gomock/Psi matchers, that are applied to *url.URL object
- TransformUrlFromString() transform can be given as first argument, so string->*url.URL transform is applied
Types ¶
This section is empty.