diff options
Diffstat (limited to 'test/test.cpp')
-rw-r--r-- | test/test.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/test.cpp b/test/test.cpp index d6f14cb..0b1290c 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -2,7 +2,7 @@ * uriparser - RFC 3986 URI parsing library * * Copyright (C) 2007, Weijia Song <songweijia@gmail.com> - * Copyright (C) 2007, Sebastian Pipping <webmaster@hartwork.org> + * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -98,6 +98,7 @@ public: TEST_ADD(UriSuite::testCrash_FreeUriMembers_Bug20080116) TEST_ADD(UriSuite::testCrash_Report2418192) TEST_ADD(UriSuite::testPervertedQueryString); + TEST_ADD(UriSuite::testQueryStringEndingInEqualSign_NonBug32); TEST_ADD(UriSuite::testCrash_MakeOwner_Bug20080207) TEST_ADD(UriSuite::testQueryList) TEST_ADD(UriSuite::testQueryListPair) @@ -1576,6 +1577,26 @@ Rule | Example | hostSet | absPath | emptySeg helperTestQueryString("http://example.org/?&&=&&&=&&&&==&===&====", 5); } + void testQueryStringEndingInEqualSign_NonBug32() { + const char * queryString = "firstname=sdsd&lastname="; + + UriQueryListA * queryList = NULL; + int itemCount = 0; + const int res = uriDissectQueryMallocA(&queryList, &itemCount, + queryString, queryString + strlen(queryString)); + + TEST_ASSERT(res == URI_SUCCESS); + TEST_ASSERT(itemCount == 2); + TEST_ASSERT(queryList != NULL); + TEST_ASSERT(strcmp(queryList->key, "firstname") == 0); + TEST_ASSERT(strcmp(queryList->value, "sdsd") == 0); + TEST_ASSERT(strcmp(queryList->next->key, "lastname") == 0); + TEST_ASSERT(strcmp(queryList->next->value, "") == 0); + TEST_ASSERT(queryList->next->next == NULL); + + uriFreeQueryListA(queryList); + } + void helperTestQueryString(char const * uriString, int pairsExpected) { UriParserStateA state; UriUriA uri; |