-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Showing
1 changed file
with
16 additions
and
16 deletions.
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 |
---|---|---|
|
@@ -1989,19 +1989,19 @@ TEST_CASE("[String] Variant ptr indexed set") { | |
} | ||
|
||
TEST_CASE("[String][URL] Parse URL") { | ||
#define CHECK_URL(url_to_parse, expected_schema, expected_host, expected_port, expected_path, expected_error) \ | ||
do { \ | ||
int port; \ | ||
String url(url_to_parse), schema, host, path; \ | ||
\ | ||
CHECK_EQ(expected_error, url.parse_url(schema, host, port, path)); \ | ||
CHECK_EQ(expected_schema, schema); \ | ||
CHECK_EQ(expected_host, host); \ | ||
CHECK_EQ(expected_path, path); \ | ||
CHECK_EQ(expected_port, port); \ | ||
#define CHECK_URL(m_url_to_parse, m_expected_schema, m_expected_host, m_expected_port, m_expected_path, m_expected_error) \ | ||
do { \ | ||
int port; \ | ||
String url(m_url_to_parse), schema, host, path; \ | ||
\ | ||
CHECK_EQ(m_expected_error, url.parse_url(schema, host, port, path)); \ | ||
CHECK_EQ(m_expected_schema, schema); \ | ||
CHECK_EQ(m_expected_host, host); \ | ||
CHECK_EQ(m_expected_path, path); \ | ||
CHECK_EQ(m_expected_port, port); \ | ||
} while (false) | ||
|
||
// Valid URLs | ||
// Valid URLs. | ||
CHECK_URL("https://godotengine.org", "https://", "godotengine.org", 0, "", Error::OK); | ||
CHECK_URL("https://godotengine.org/", "https://", "godotengine.org", 0, "/", Error::OK); | ||
CHECK_URL("godotengine.org/", "", "godotengine.org", 0, "/", Error::OK); | ||
|
@@ -2015,15 +2015,15 @@ TEST_CASE("[String][URL] Parse URL") { | |
CHECK_URL("https://me:[email protected]", "https://", "godotengine.org", 0, "", Error::OK); | ||
CHECK_URL("https://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/ipv6", "https://", "fedc:ba98:7654:3210:fedc:ba98:7654:3210", 0, "/ipv6", Error::OK); | ||
|
||
// Invalid URLs | ||
// Invalid URLs. | ||
|
||
// Multiple ports | ||
// Multiple ports. | ||
CHECK_URL("https://godotengine.org:8080:433", "https://", "", 0, "", Error::ERR_INVALID_PARAMETER); | ||
// Missing ] on literal IPv6 | ||
// Missing ] on literal IPv6. | ||
CHECK_URL("https://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/ipv6", "https://", "", 0, "/ipv6", Error::ERR_INVALID_PARAMETER); | ||
// Missing host | ||
// Missing host. | ||
CHECK_URL("https:///blog", "https://", "", 0, "/blog", Error::ERR_INVALID_PARAMETER); | ||
// Invalid ports | ||
// Invalid ports. | ||
CHECK_URL("https://godotengine.org:notaport", "https://", "godotengine.org", 0, "", Error::ERR_INVALID_PARAMETER); | ||
CHECK_URL("https://godotengine.org:-8080", "https://", "godotengine.org", -8080, "", Error::ERR_INVALID_PARAMETER); | ||
CHECK_URL("https://godotengine.org:88888", "https://", "godotengine.org", 88888, "", Error::ERR_INVALID_PARAMETER); | ||
|