OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #include <string> | 18 #include <string> |
19 #include "gtest/gtest.h" | 19 #include "gtest/gtest.h" |
20 #include "compiled/String.h" | 20 #include "compiled/String.h" |
21 | 21 |
| 22 ABP_NS_USING |
| 23 |
22 TEST(TestString, constructInvalidDependentString) | 24 TEST(TestString, constructInvalidDependentString) |
23 { | 25 { |
24 DependentString s; | 26 DependentString s; |
25 EXPECT_TRUE(s.is_invalid()); | 27 EXPECT_TRUE(s.is_invalid()); |
26 | 28 |
27 DependentString s2(s); | 29 DependentString s2(s); |
28 EXPECT_TRUE(s2.is_invalid()); | 30 EXPECT_TRUE(s2.is_invalid()); |
29 } | 31 } |
30 | 32 |
31 TEST(TestString, constructInvalidOwnedString) | 33 TEST(TestString, constructInvalidOwnedString) |
32 { | 34 { |
33 OwnedString s; | 35 OwnedString s; |
34 EXPECT_TRUE(s.is_invalid()); | 36 EXPECT_TRUE(s.is_invalid()); |
35 | 37 |
36 // Valid string | 38 // Valid string |
37 OwnedString s2(2); | 39 OwnedString s2(2); |
38 EXPECT_FALSE(s2.is_invalid()); | 40 EXPECT_FALSE(s2.is_invalid()); |
39 | 41 |
40 // Ensure we still have an invalid string. | 42 // Ensure we still have an invalid string. |
41 OwnedString s3(s); | 43 OwnedString s3(s); |
42 EXPECT_TRUE(s3.is_invalid()); | 44 EXPECT_TRUE(s3.is_invalid()); |
43 | 45 |
44 // Empty valid string lead to valid string. | 46 // Empty valid string lead to valid string. |
45 OwnedString s4(u""_str); | 47 OwnedString s4(u""_str); |
46 EXPECT_FALSE(s4.is_invalid()); | 48 EXPECT_FALSE(s4.is_invalid()); |
47 } | 49 } |
48 | 50 |
OLD | NEW |