Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package is_test |
||
2 | |||
3 | import ( |
||
4 | "fmt" |
||
5 | |||
6 | "github.com/muonsoft/validation/is" |
||
7 | ) |
||
8 | |||
9 | func ExampleURL_validAbsoluteURL() { |
||
10 | valid := is.URL("https://example.com") |
||
11 | |||
12 | fmt.Println(valid) |
||
13 | // Output: |
||
14 | // true |
||
15 | } |
||
16 | |||
17 | func ExampleURL_validURLWithCustomProtocol() { |
||
18 | valid := is.URL("ftp://example.com", "http", "https", "ftp") |
||
19 | |||
20 | fmt.Println(valid) |
||
21 | // Output: |
||
22 | // true |
||
23 | } |
||
24 | |||
25 | func ExampleURL_invalidURL() { |
||
26 | valid := is.URL("example.com") |
||
27 | |||
28 | fmt.Println(valid) |
||
29 | // Output: |
||
30 | // false |
||
31 | } |
||
32 | |||
33 | func ExampleRelativeURL_validRelativeURL() { |
||
34 | valid := is.RelativeURL("//example.com") |
||
35 | |||
36 | fmt.Println(valid) |
||
37 | // Output: |
||
38 | // true |
||
39 | } |
||
40 | |||
41 | func ExampleRelativeURL_invalidURL() { |
||
42 | valid := is.RelativeURL("example.com") |
||
43 | |||
44 | fmt.Println(valid) |
||
45 | // Output: |
||
48 |