mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Enable path in args test
This commit is contained in:
parent
fb38537f20
commit
6a23c5bace
@ -108,16 +108,6 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
|
||||
for (; i < entry.args.size(); ++i) {
|
||||
std::string arg = entry.args[i];
|
||||
|
||||
// If blacklist skip.
|
||||
if (!next_flag_is_path) {
|
||||
if (StartsWithAny(arg, kBlacklistMulti)) {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (StartsWithAny(arg, kBlacklist) || arg == result.filename)
|
||||
continue;
|
||||
}
|
||||
|
||||
auto cleanup_maybe_relative_path = [&](const std::string& path) {
|
||||
// TODO/FIXME: Normalization will fail for paths that do not exist. Should
|
||||
// it return an optional<std::string>?
|
||||
@ -127,6 +117,20 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
|
||||
return NormalizePathWithTestOptOut(entry.directory + "/" + path);
|
||||
};
|
||||
|
||||
// Do not include path.
|
||||
if (result.filename == cleanup_maybe_relative_path(arg))
|
||||
continue;
|
||||
|
||||
// If blacklist skip.
|
||||
if (!next_flag_is_path) {
|
||||
if (StartsWithAny(arg, kBlacklistMulti)) {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (StartsWithAny(arg, kBlacklist))
|
||||
continue;
|
||||
}
|
||||
|
||||
// Cleanup path for previous argument.
|
||||
if (next_flag_is_path) {
|
||||
arg = cleanup_maybe_relative_path(arg);
|
||||
@ -465,15 +469,14 @@ TEST_SUITE("Project") {
|
||||
"-resource-dir=/w/resource_dir/"});
|
||||
}
|
||||
|
||||
#if false
|
||||
// FIXME: Fix this test.
|
||||
TEST_CASE("Path in args") {
|
||||
CheckFlags("/home/user", "/home/user/foo/bar.c",
|
||||
/* raw */ {"cc", "-O0", "foo/bar.c"},
|
||||
/* expected */
|
||||
{"-O0", "-xc", "-std=c11", "-resource-dir=/w/resource_dir/"});
|
||||
CheckFlags(
|
||||
"/home/user", "/home/user/foo/bar.c",
|
||||
/* raw */ {"cc", "-O0", "foo/bar.c"},
|
||||
/* expected */
|
||||
{"cc", "-O0", "-xc", "-std=c11", "-resource-dir=/w/resource_dir/"});
|
||||
}
|
||||
#endif
|
||||
|
||||
// Checks flag parsing for a random chromium file in comparison to what
|
||||
// YouCompleteMe fetches.
|
||||
|
Loading…
Reference in New Issue
Block a user