[PATCH] D52775: [clangd] Add a #include completion test that triggers an assertion.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 03:02:05 PDT 2018


hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, ioeric, ilya-biryukov.

Test for https://reviews.llvm.org/D52774.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52775

Files:
  unittests/clangd/CodeCompleteTests.cpp


Index: unittests/clangd/CodeCompleteTests.cpp
===================================================================
--- unittests/clangd/CodeCompleteTests.cpp
+++ unittests/clangd/CodeCompleteTests.cpp
@@ -2093,6 +2093,15 @@
                     Has("bar.h\"", CompletionItemKind::File)));
 }
 
+TEST(CompletionTest, NoCrashAtNonAlphaIncludeHeader) {
+  auto Results = completions(
+      R"cpp(
+        #include "./^"
+      )cpp"
+      );
+  EXPECT_TRUE(Results.Completions.empty());
+}
+
 TEST(CompletionTest, NoAllScopesCompletionWhenQualified) {
   clangd::CodeCompleteOptions Opts = {};
   Opts.AllScopes = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52775.167908.patch
Type: text/x-patch
Size: 619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181002/ed0c1425/attachment.bin>


More information about the cfe-commits mailing list