================
@@ -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 \
----------------
HighCommander4 wrote:

Please use `XDG_CONFIG_HOME=%t` the way [this 
test](https://searchfox.org/llvm/rev/76080a43202b5ae30f77f43845ecc9ca7a7b709d/clang-tools-extra/clangd/test/config.test#12)
 does. (Also needs 
[this](https://searchfox.org/llvm/rev/76080a43202b5ae30f77f43845ecc9ca7a7b709d/clang-tools-extra/clangd/test/config.test#1-3)
 to go along with it.)

Otherwise, the test is going to pick up `~/.config/clangd/config.yaml` in the 
home directory of whoever happens to be running it locally.

https://github.com/llvm/llvm-project/pull/214951
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to