Skip to content

Commit

Permalink
Add more query tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Apr 30, 2023
1 parent c3fa05b commit 6f7d865
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,27 @@ int main() {
assert(uWS::getDecodedQueryValue("test2", (char *) buf.data()) == "someValue");
}

{
std::string buf = "?Kest1=&test2=someValue";
assert(uWS::getDecodedQueryValue("test2", (char *) buf.data()) == "someValue");
}

{
std::string buf = "?Test1=&Kest2=some";
assert(uWS::getDecodedQueryValue("Test1", (char *) buf.data()) == "");
assert(uWS::getDecodedQueryValue("Kest2", (char *) buf.data()) == "some");
}

{
std::string buf = "?Test1=&Kest2=some";
assert(uWS::getDecodedQueryValue("Test1", (char *) buf.data()).data() != nullptr);
assert(uWS::getDecodedQueryValue("sdfsdf", (char *) buf.data()).data() == nullptr);
}

{
std::string buf = "?Kest1=&test2=some%20Value";
assert(uWS::getDecodedQueryValue("test2", (char *) buf.data()) == "some Value");
}

return 0;
}

0 comments on commit 6f7d865

Please sign in to comment.