-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61b06f4
commit 12481ab
Showing
1 changed file
with
7 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,6 +237,8 @@ var userInfoTests = []extractTest{ | |
UserInfo: "usern@me:", Domain: "example", Suffix: "com", RegisteredDomain: "example.com"}, description: "colon but empty password; @ in username"}, | ||
{urlParams: URLParams{URL: "https://:p@[email protected]"}, expected: &ExtractResult{Scheme: "https://", | ||
UserInfo: ":p@ssword", Domain: "example", Suffix: "com", RegisteredDomain: "example.com"}, description: "colon but empty username; @ in password"}, | ||
{urlParams: URLParams{URL: "https://usern@m%40e:[email protected]/p@th?q=@go"}, expected: &ExtractResult{Scheme: "https://", | ||
UserInfo: "usern@m%40e:password", Domain: "example", Suffix: "com", RegisteredDomain: "example.com", Path: "/p@th?q=@go"}, description: "@ in UserInfo and Path"}, | ||
} | ||
var ipv4Tests = []extractTest{ | ||
{urlParams: URLParams{URL: "127.0.0.1"}, | ||
|
@@ -341,7 +343,7 @@ var invalidTests = []extractTest{ | |
SubDomain: "maps", Domain: "google", Suffix: "com.sg", | ||
RegisteredDomain: "google.com.sg", | ||
}, description: "Invalid Port number"}, | ||
{urlParams: URLParams{URL: "//server.example.com/path"}, expected: &ExtractResult{Scheme: "//", SubDomain: "server", Domain: "example", Suffix: "com", RegisteredDomain: "example.com", Path: "/path"}, description: "Missing protocol URL with subdomain"}, | ||
{urlParams: URLParams{URL: "//server.example.com/path"}, expected: &ExtractResult{Scheme: "//", SubDomain: "server", Domain: "example", Suffix: "com", RegisteredDomain: "example.com", Path: "/path"}, description: "Double-slash only Scheme with subdomain"}, | ||
{urlParams: URLParams{URL: "http://temasek"}, expected: &ExtractResult{Scheme: "http://", Suffix: "temasek"}, description: "Basic URL with TLD only"}, | ||
{urlParams: URLParams{URL: "http://temasek.this-tld-cannot-be-real"}, expected: &ExtractResult{Scheme: "http://", SubDomain: "temasek", Domain: "this-tld-cannot-be-real"}, description: "Basic URL with bad TLD"}, | ||
{urlParams: URLParams{URL: "http://temasek.temasek.this-tld-cannot-be-real"}, expected: &ExtractResult{Scheme: "http://", SubDomain: "temasek.temasek", Domain: "this-tld-cannot-be-real"}, description: "Basic URL with subdomain and bad TLD"}, | ||
|
@@ -434,6 +436,9 @@ var domainOnlySingleTLDTests = []extractTest{ | |
{urlParams: URLParams{URL: "https://example.sg/en"}, expected: &ExtractResult{Scheme: "https://", Domain: "example", Suffix: "sg", RegisteredDomain: "example.sg", Path: "/en"}, description: "Domain only + sg"}, | ||
{urlParams: URLParams{URL: "https://example.tv/en"}, expected: &ExtractResult{Scheme: "https://", Domain: "example", Suffix: "tv", RegisteredDomain: "example.tv", Path: "/en"}, description: "Domain only + tv"}, | ||
} | ||
var pathTests = []extractTest{ | ||
{urlParams: URLParams{URL: "http://www.example.com/this:that"}, expected: &ExtractResult{Scheme: "http://", SubDomain: "www", Domain: "example", Suffix: "com", RegisteredDomain: "example.com", Path: "/this:that"}, description: "Colon in Path"}, | ||
} | ||
var wildcardTests = []extractTest{ | ||
{urlParams: URLParams{URL: "https://asdf.wwe.ck"}, | ||
expected: &ExtractResult{ | ||
|
@@ -613,6 +618,7 @@ func TestExtract(t *testing.T) { | |
invalidTests, | ||
internationalTLDTests, | ||
domainOnlySingleTLDTests, | ||
pathTests, | ||
wildcardTests, | ||
lookoutTests, | ||
} { | ||
|