Index: test/UtilGetQueryString.cpp |
diff --git a/test/UtilGetQueryString.cpp b/test/UtilGetQueryString.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2869503c7faccd5a6957eb706916790fe9678ac0 |
--- /dev/null |
+++ b/test/UtilGetQueryString.cpp |
@@ -0,0 +1,45 @@ |
+/* |
+ * This file is part of Adblock Plus <http://adblockplus.org/>, |
+ * Copyright (C) 2006-2014 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, UrlWithQueryString) |
+{ |
+ EXPECT_EQ(L"queryString", GetQueryString(L"schema://host/path1/path2?queryString")); |
+} |
Eric
2015/02/02 18:41:58
Need a test for an empty query string
L"schem
sergei
2015/02/12 14:44:06
added
|
+ |
+TEST(GetQueryStringTest, UrlWithQueryStringAndHash) |
+{ |
+ EXPECT_EQ(L"queryString=value", GetQueryString(L"schema://host/path1/path2?queryString=value#")); |
+} |
Eric
2015/02/02 18:41:58
There are three tests with empty anchor strings. N
sergei
2015/02/12 14:44:06
I disagree here. According to such logic we should
Eric
2015/02/12 17:24:41
No, not an infinite number of tests. Simply a few
sergei
2015/02/13 15:21:56
Added.
|
+ |
+TEST(GetQueryStringTest, UrlWithoutQuestionSign) |
+{ |
+ EXPECT_EQ(L"", GetQueryString(L"schema://host/path1/path2#")); |
+} |
+ |
+TEST(GetQueryStringTest, UrlWithEmptyQueryStringAndWithHash) |
+{ |
+ EXPECT_EQ(L"", GetQueryString(L"schema://host/path1/path2?#")); |
+} |
+ |