diff options
author | Manuel Klimek <klimek@google.com> | 2011-05-02 18:27:26 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2011-05-02 18:27:26 +0000 |
commit | 850dd809534d172b66328d9827ae27880885ac5b (patch) | |
tree | 460f7728e61da892a01103df9eed5bccbaa5cf42 /unittests | |
parent | f4bbbf0aaf741cc7d014e2cf059670a6756f8cbd (diff) |
Adds a test for the command line parser when a quoted string is not closed by a quote.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp b/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp index d875293e5d..2a911d1063 100644 --- a/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp +++ b/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(); |