summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp b/clang/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp
index d875293e5d8..2a911d10635 100644
--- a/clang/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp
+++ b/clang/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp
@@ -92,6 +92,20 @@ TEST(UnescapeJsonCommandLine, ParsesStringsWithoutSpacesIntoSingleArgument) {
EXPECT_EQ("abcdefg", MixedNoSpaces[0]);
}
+TEST(UnescapeJsonCommandLine, ParsesQuotedStringWithoutClosingQuote) {
+ std::vector<std::string> Unclosed = UnescapeJsonCommandLine("\"abc");
+ ASSERT_EQ(1ul, Unclosed.size());
+ EXPECT_EQ("abc", Unclosed[0]);
+
+ std::vector<std::string> EndsInBackslash = UnescapeJsonCommandLine("\"a\\");
+ ASSERT_EQ(1ul, EndsInBackslash.size());
+ EXPECT_EQ("a", EndsInBackslash[0]);
+
+ std::vector<std::string> Empty = UnescapeJsonCommandLine("\"");
+ ASSERT_EQ(1ul, Empty.size());
+ EXPECT_EQ("", Empty[0]);
+}
+
TEST(JsonCompileCommandLineParser, FailsOnEmptyString) {
JsonCompileCommandLineParser Parser("", NULL);
EXPECT_FALSE(Parser.Parse()) << Parser.GetErrorMessage();
OpenPOWER on IntegriCloud