Skip to content

Commit

Permalink
fixup! fixup! Add iterator support to url_search_params and ada_c
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Oct 10, 2023
1 parent ed94fe5 commit 62956d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions include/ada/url_search_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ struct url_search_params {
inline std::string to_string();

/**
* Returns a simple JS-style iterator over all of the keys in this url_search_params.
* The keys in the iterator are not unique. The valid lifespan of the iterator
* is tied to the url_search_params. The iterator must be freed when you're
* done with it.
* Returns a simple JS-style iterator over all of the keys in this
* url_search_params. The keys in the iterator are not unique. The valid
* lifespan of the iterator is tied to the url_search_params. The iterator
* must be freed when you're done with it.
* @see https://url.spec.whatwg.org/#interface-urlsearchparams
*/
inline url_search_params_keys_iter get_keys();

/**
* Returns a simple JS-style iterator over all of the values in this url_search_params.
* The valid lifespan of the iterator is tied to the url_search_params. The
* iterator must be freed when you're done with it.
* Returns a simple JS-style iterator over all of the values in this
* url_search_params. The valid lifespan of the iterator is tied to the
* url_search_params. The iterator must be freed when you're done with it.
* @see https://url.spec.whatwg.org/#interface-urlsearchparams
*/
inline url_search_params_values_iter get_values();
Expand Down
10 changes: 5 additions & 5 deletions tests/url_search_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ TEST(url_search_params, iterators) {
ASSERT_FALSE(entries.next().has_value());

// C++ conventional iterator
std::vector<std::pair<std::string,std::string>> expected = {
{"foo", "bar"},
{"key2", "value3"},
{"key1", "value2"},
{"key1", "value1"},
std::vector<std::pair<std::string, std::string>> expected = {
{"foo", "bar"},
{"key2", "value3"},
{"key1", "value2"},
{"key1", "value1"},
};
for (auto& entry : search_params) {
auto check = expected.back();
Expand Down

0 comments on commit 62956d1

Please sign in to comment.