Author: klimek
Date: Mon May  2 13:27:26 2011
New Revision: 130704

URL: http://llvm.org/viewvc/llvm-project?rev=130704&view=rev
Log:
Adds a test for the command line parser when a quoted string is not closed by a 
quote.

Modified:
    cfe/trunk/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp

Modified: cfe/trunk/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp?rev=130704&r1=130703&r2=130704&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp 
(original)
+++ cfe/trunk/unittests/Tooling/JsonCompileCommandLineDatabaseTest.cpp Mon May  
2 13:27:26 2011
@@ -92,6 +92,20 @@
   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();


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to