Skip to content

Commit

Permalink
Coding style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pafuent committed Sep 23, 2024
1 parent e4525f1 commit 7e3ca9a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/core/string/test_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 7e3ca9a

Please sign in to comment.