Skip to content

Commit

Permalink
Add a regression test for url_search_params::sort taken from WPT
Browse files Browse the repository at this point in the history
  • Loading branch information
npaun committed Jan 30, 2025
1 parent d44402b commit aa8bdf3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/url_search_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ TEST(url_search_params, sort) {
SUCCEED();
}

// Taken from
// https://github.com/web-platform-tests/wpt/blob/d5085f61e2d949bc9fb24b04f4c6a47bdf6d3be9/url/urlsearchparams-sort.any.js#L11
TEST(url_search_params, sort_unicode_code_units) {
auto search_params = ada::url_search_params();
search_params.reset("ffi&🌈"); // 🌈 > code point, but < code unit because two code units
search_params.sort();
ASSERT_EQ(search_params.size(), 2);
auto keys = search_params.get_keys();
ASSERT_EQ(keys.next(), "🌈");
ASSERT_EQ(keys.next(), "");
SUCCEED();
}

TEST(url_search_params, string_constructor) {
auto p = ada::url_search_params("?a=b");
ASSERT_EQ(p.to_string(), "a=b");
Expand Down

0 comments on commit aa8bdf3

Please sign in to comment.