Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/compiled/String.cpp

Issue 29680720: Issue 6221 - Add native tests. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Changes from review. Created Jan. 27, 2018, 3:33 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/compiled/String.cpp
===================================================================
new file mode 100644
--- /dev/null
+++ b/test/compiled/String.cpp
@@ -0,0 +1,48 @@
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-present 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 <string>
+#include "gtest/gtest.h"
+#include "compiled/String.h"
+
+TEST(TestString, DependentString)
+{
+ DependentString s;
+ EXPECT_TRUE(s.is_invalid());
+
+ DependentString s2(s);
+ EXPECT_TRUE(s2.is_invalid());
+}
+
+TEST(TestString, OwnedString)
sergei 2018/01/29 13:38:44 It's not important for this change set but in gene
hub 2018/01/29 16:57:46 Done.
+{
+ OwnedString s;
+ EXPECT_TRUE(s.is_invalid());
+
+ // Valid string
+ OwnedString s2(2);
+ EXPECT_FALSE(s2.is_invalid());
+
+ // Ensure we still have an invalid string.
+ OwnedString s3(s);
+ EXPECT_TRUE(s3.is_invalid());
+
+ // Empty valid string lead to valid string.
+ OwnedString s4(u""_str);
+ EXPECT_FALSE(s4.is_invalid());
+}
+

Powered by Google App Engine
This is Rietveld