diff options
Diffstat (limited to 'url_test.go')
| -rw-r--r-- | url_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/url_test.go b/url_test.go index 698c49c..506090d 100644 --- a/url_test.go +++ b/url_test.go @@ -16,6 +16,9 @@ func TestUrlString(t *testing.T) { exp string } var listCase = []testCase{{ + rawUrl: `/page#goto`, + exp: `/page`, + }, { rawUrl: `http://127.0.0.1`, exp: `http://127.0.0.1`, }, { @@ -27,12 +30,20 @@ func TestUrlString(t *testing.T) { }, { rawUrl: `http://127.0.0.1/page/`, exp: `http://127.0.0.1/page/`, + }, { + rawUrl: `http://127.0.0.1/page/#gotoa`, + exp: `http://127.0.0.1/page/`, + }, { + rawUrl: `http://127.0.0.1/page#gotoa`, + exp: `http://127.0.0.1/page`, }} for _, tcase := range listCase { gotUrl, err := url.Parse(tcase.rawUrl) if err != nil { t.Fatal(err) } + gotUrl.Fragment = "" + gotUrl.RawFragment = "" var got = gotUrl.String() test.Assert(t, tcase.rawUrl, tcase.exp, got) } |
