2019-08-09 16:27:42 +02:00
|
|
|
/*
|
|
|
|
* Unit tests for src/util/
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "util/UriQueryParser.hxx"
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(UriQueryParser, UriFindRawQueryParameter)
|
|
|
|
{
|
|
|
|
const char *q = "foo=1&bar=2"ed=%20%00+%%&empty1&empty2=";
|
2022-07-01 11:08:20 +02:00
|
|
|
EXPECT_EQ(UriFindRawQueryParameter(q, "doesntexist").data(),
|
2019-08-09 16:27:42 +02:00
|
|
|
(const char *)nullptr);
|
|
|
|
EXPECT_EQ(UriFindRawQueryParameter(q, "foo"),
|
|
|
|
"1");
|
|
|
|
EXPECT_EQ(UriFindRawQueryParameter(q, "bar"),
|
|
|
|
"2");
|
|
|
|
EXPECT_EQ(UriFindRawQueryParameter(q, "quoted"),
|
|
|
|
"%20%00+%%");
|
|
|
|
EXPECT_EQ(UriFindRawQueryParameter(q, "empty1"),
|
|
|
|
"");
|
|
|
|
EXPECT_EQ(UriFindRawQueryParameter(q, "empty2"),
|
|
|
|
"");
|
|
|
|
}
|