mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 09:31:59 +00:00
Add failing test for issue #42
This commit is contained in:
parent
5f73c7efac
commit
475cd6b668
@ -263,10 +263,12 @@ std::vector<Project::Entry> LoadCompilationEntriesFromDirectory(
|
|||||||
unsigned num_args = clang_CompileCommand_getNumArgs(cx_command);
|
unsigned num_args = clang_CompileCommand_getNumArgs(cx_command);
|
||||||
CompileCommandsEntry entry;
|
CompileCommandsEntry entry;
|
||||||
entry.args.reserve(num_args);
|
entry.args.reserve(num_args);
|
||||||
for (unsigned j = 0; j < num_args; ++j)
|
for (unsigned j = 0; j < num_args; ++j) {
|
||||||
entry.args.push_back(
|
entry.args.push_back(
|
||||||
ToString(clang_CompileCommand_getArg(cx_command, j)));
|
ToString(clang_CompileCommand_getArg(cx_command, j)));
|
||||||
|
}
|
||||||
clang_time.Pause(); // TODO: don't call ToString in this block.
|
clang_time.Pause(); // TODO: don't call ToString in this block.
|
||||||
|
// LOG_S(INFO) << "Got args " << StringJoin(entry.args);
|
||||||
|
|
||||||
our_time.Resume();
|
our_time.Resume();
|
||||||
std::string absolute_filename;
|
std::string absolute_filename;
|
||||||
@ -423,6 +425,11 @@ TEST_SUITE("Project") {
|
|||||||
Project::Entry result =
|
Project::Entry result =
|
||||||
GetCompilationEntryFromCompileCommandEntry(&config, entry);
|
GetCompilationEntryFromCompileCommandEntry(&config, entry);
|
||||||
|
|
||||||
|
if (result.args != expected) {
|
||||||
|
std::cout << "Raw: " << StringJoin(raw) << std::endl;
|
||||||
|
std::cout << "Expected: " << StringJoin(expected) << std::endl;
|
||||||
|
std::cout << "Actual: " << StringJoin(result.args) << std::endl;
|
||||||
|
}
|
||||||
bool printed_header = false;
|
bool printed_header = false;
|
||||||
for (int i = 0; i < std::min(result.args.size(), expected.size()); ++i) {
|
for (int i = 0; i < std::min(result.args.size(), expected.size()); ++i) {
|
||||||
if (result.args[i] != expected[i]) {
|
if (result.args[i] != expected[i]) {
|
||||||
@ -458,6 +465,17 @@ TEST_SUITE("Project") {
|
|||||||
"-resource-dir=/w/resource_dir/"});
|
"-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", "&foo/bar.c", "-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.
|
||||||
TEST_CASE("ycm") {
|
TEST_CASE("ycm") {
|
||||||
|
Loading…
Reference in New Issue
Block a user