Index: test/UtilGetQueryStringTest.cpp |
diff --git a/test/UtilGetQueryStringTest.cpp b/test/UtilGetQueryStringTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8a0152df06ae5dc7a57901751e763e77b78a3b99 |
--- /dev/null |
+++ b/test/UtilGetQueryStringTest.cpp |
@@ -0,0 +1,50 @@ |
+/* |
+ * This file is part of Adblock Plus <https://adblockplus.org/>, |
+ * Copyright (C) 2006-2015 Eyeo GmbH |
+ * |
+ * Adblock Plus is free software: you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License version 3 as |
+ * published by the Free Software Foundation. |
+ * |
+ * Adblock Plus is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
+ */ |
+ |
+#include <gtest/gtest.h> |
+#include "../src/shared/Utils.h" |
+ |
+TEST(GetQueryStringTest, SimpleUrl) |
+{ |
+ EXPECT_EQ(L"", GetQueryString(L"schema://host/path1/path2")); |
+} |
+ |
+TEST(GetQueryStringTest, EmptyQueryString) |
+{ |
+ EXPECT_EQ(L"", GetQueryString(L"schema://host/path1/path2?")); |
+} |
+ |
+TEST(GetQueryStringTest, UrlWithQueryString) |
+{ |
+ EXPECT_EQ(L"queryString", GetQueryString(L"schema://host/path1/path2?queryString")); |
+} |
+ |
+TEST(GetQueryStringTest, UrlWithQueryStringAndHash) |
+{ |
+ EXPECT_EQ(L"queryString=value", GetQueryString(L"schema://host/path1/path2?queryString=value#")); |
+} |
+ |
+TEST(GetQueryStringTest, UrlWithoutQuestionSign) |
+{ |
+ EXPECT_EQ(L"", GetQueryString(L"schema://host/path1/path2#")); |
+} |
+ |
+TEST(GetQueryStringTest, UrlWithEmptyQueryStringAndWithHash) |
+{ |
+ EXPECT_EQ(L"", GetQueryString(L"schema://host/path1/path2?#")); |
+} |
+ |