================
@@ -0,0 +1,25 @@
+# Test that clangd-indexer respects CompileFlags
+
+# RUN: rm -rf %t.dir && mkdir -p %t.dir
+# RUN: split-file %s %t.dir
+
+# By default config is disabled, so the .clangd file's CompileFlags.Add is not
+# applied and the #error below must fire.
+# RUN: clangd-indexer %t.dir/test.cpp 2>&1 | FileCheck --check-prefix=DISABLED
%s
+# DISABLED: error: "FROM_CLANGD_FILE not defined - .clangd file was not
applied"
+
+# With config enabled, the .clangd file's CompileFlags.Add should define
+# FROM_CLANGD_FILE, so the #error below must not fire.
+# RUN: clangd-indexer --enable-config %t.dir/test.cpp 2>&1 \
+# RUN: | FileCheck --check-prefix=ENABLED %s
+# ENABLED-NOT: error: "FROM_CLANGD_FILE not defined
----------------
HighCommander4 wrote:
Before this negative check, add a positive check like:
```
# ENABLED: Processing file {{.*}}test.cpp
```
This ensures that the indexer is running successfully, and the test is not
accidentally passing because something in the test setup has broken.
https://github.com/llvm/llvm-project/pull/214951
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits