Skip to content

Commit

Permalink
add failing wpt tests for url_search_params
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Dec 2, 2024
1 parent f7fbea5 commit 9189c77
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/url_search_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,22 @@ TEST(url_search_params, test_character_set) {
}
SUCCEED();
}

// https://github.com/web-platform-tests/wpt/blob/76dfa54e5df7f8cee7501cc6d598cf647c2b8564/url/urlsearchparams-constructor.any.js#L203
// Construct with 2 unpaired surrogates (no trailing)
TEST(url_search_params, unpaired_surrogates_no_trailing) {
auto search_params = ada::url_search_params("\uD835x=1&xx=2&\uD83Dx=3");
ASSERT_EQ(search_params.get("\uFFFDx"), "3");
ASSERT_EQ(search_params.get("xx"), "2");
ASSERT_EQ(search_params.size(), 2);
SUCCEED();
}

// https://github.com/web-platform-tests/wpt/blob/76dfa54e5df7f8cee7501cc6d598cf647c2b8564/url/urlsearchparams-constructor.any.js#L204
// 3 unpaired surrogates (no leading)
TEST(url_search_params, unpaired_surrogates_no_leading) {
auto search_params = ada::url_search_params("x\uDC53=1&x\uDC5C=2&x\uDC65=3");
ASSERT_EQ(search_params.get("x\uFFFD"), 3);
ASSERT_EQ(search_params.size(), 1);
SUCCEED();
}

0 comments on commit 9189c77

Please sign in to comment.