summaryrefslogtreecommitdiff
path: root/parse_test.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2021-08-20 19:52:48 -0700
committerAlex Flint <[email protected]>2021-08-20 19:52:48 -0700
commit3d59e5e89e775b1d33a451aca6aa4bda4fbad500 (patch)
tree71788f3ee1badc138e0f243e15257cf9d2e7c663 /parse_test.go
parenteb0393e9bc0bbd8d3cc37a6ee98c1d538e4e5c91 (diff)
bump go-scalar to v1.1 and add documentation about supported types
Diffstat (limited to 'parse_test.go')
-rw-r--r--parse_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/parse_test.go b/parse_test.go
index e78b4d4..284e386 100644
--- a/parse_test.go
+++ b/parse_test.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net"
"net/mail"
+ "net/url"
"os"
"strings"
"testing"
@@ -961,6 +962,24 @@ func TestPtrToIP(t *testing.T) {
assert.Equal(t, "192.168.0.1", args.Host.String())
}
+func TestURL(t *testing.T) {
+ var args struct {
+ URL url.URL
+ }
+ err := parse("--url https://example.com/get?item=xyz", &args)
+ require.NoError(t, err)
+ assert.Equal(t, "https://example.com/get?item=xyz", args.URL.String())
+}
+
+func TestPtrToURL(t *testing.T) {
+ var args struct {
+ URL *url.URL
+ }
+ err := parse("--url http://example.com/#xyz", &args)
+ require.NoError(t, err)
+ assert.Equal(t, "http://example.com/#xyz", args.URL.String())
+}
+
func TestIPSlice(t *testing.T) {
var args struct {
Host []net.IP