Index: test/compiled/String.cpp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/test/compiled/String.cpp |
@@ -0,0 +1,34 @@ |
+ |
+#include <string> |
+ |
sergei
2018/01/26 22:13:36
Could you please remove the empty lines and add th
hub
2018/01/27 03:33:37
Done.
|
+#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) |
+{ |
+ 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()); |
+} |
+ |