1# Use a copy of inputs, as we'll mutate it (as will the background index). 2# RUN: rm -rf %/t 3# RUN: cp -r %/S/Inputs/background-index %/t 4# Need to embed the correct temp path in the actual JSON-RPC requests. 5# RUN: sed -e "s|DIRECTORY|%/t|" %/t/definition.jsonrpc.tmpl > %/t/definition.jsonrpc.1 6# RUN: sed -e "s|DIRECTORY|%/t|" %/t/compile_commands.json.tmpl > %/t/compile_commands.json 7# On Windows, we need the URI in didOpen to look like "uri":"file:///C:/..." 8# (with the extra slash in the front), so we add it here. 9# RUN: sed -E -e 's|"file://([A-Z]):/|"file:///\1:/|g' %/t/definition.jsonrpc.1 > %/t/definition.jsonrpc 10 11# We're editing bar.cpp, which includes foo.h. 12# foo() is declared in foo.h and defined in foo.cpp. 13# The background index should allow us to go-to-definition on foo(). 14# We should also see indexing progress notifications. 15# RUN: clangd -background-index -lit-test < %/t/definition.jsonrpc | FileCheck %/t/definition.jsonrpc --check-prefixes=CHECK,BUILD 16 17# Test that the index is writing files in the expected location. 18# RUN: ls %/t/.cache/clangd/index/foo.cpp.*.idx 19# RUN: ls %/t/sub_dir/.cache/clangd/index/foo.h.*.idx 20 21# Test the index is read from disk: delete code and restart clangd. 22# RUN: rm %/t/foo.cpp 23# RUN: clangd -background-index -lit-test < %/t/definition.jsonrpc | FileCheck %/t/definition.jsonrpc --check-prefixes=CHECK,USE 24