mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45: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) {
|
for (; i < entry.args.size(); ++i) {
|
||||||
std::string arg = entry.args[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) {
|
auto cleanup_maybe_relative_path = [&](const std::string& path) {
|
||||||
// TODO/FIXME: Normalization will fail for paths that do not exist. Should
|
// TODO/FIXME: Normalization will fail for paths that do not exist. Should
|
||||||
// it return an optional<std::string>?
|
// it return an optional<std::string>?
|
||||||
@ -127,6 +117,20 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
|
|||||||
return NormalizePathWithTestOptOut(entry.directory + "/" + path);
|
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.
|
// Cleanup path for previous argument.
|
||||||
if (next_flag_is_path) {
|
if (next_flag_is_path) {
|
||||||
arg = cleanup_maybe_relative_path(arg);
|
arg = cleanup_maybe_relative_path(arg);
|
||||||
@ -465,15 +469,14 @@ TEST_SUITE("Project") {
|
|||||||
"-resource-dir=/w/resource_dir/"});
|
"-resource-dir=/w/resource_dir/"});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if false
|
|
||||||
// FIXME: Fix this test.
|
// FIXME: Fix this test.
|
||||||
TEST_CASE("Path in args") {
|
TEST_CASE("Path in args") {
|
||||||
CheckFlags("/home/user", "/home/user/foo/bar.c",
|
CheckFlags(
|
||||||
/* raw */ {"cc", "-O0", "foo/bar.c"},
|
"/home/user", "/home/user/foo/bar.c",
|
||||||
/* expected */
|
/* raw */ {"cc", "-O0", "foo/bar.c"},
|
||||||
{"-O0", "-xc", "-std=c11", "-resource-dir=/w/resource_dir/"});
|
/* expected */
|
||||||
|
{"cc", "-O0", "-xc", "-std=c11", "-resource-dir=/w/resource_dir/"});
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Checks flag parsing for a random chromium file in comparison to what
|
// Checks flag parsing for a random chromium file in comparison to what
|
||||||
// YouCompleteMe fetches.
|
// YouCompleteMe fetches.
|
||||||
|
Loading…
Reference in New Issue
Block a user