mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 13:48:04 +00:00
Use indented TEST_SUITE
This commit is contained in:
parent
424c7b69db
commit
297ed1d13e
@ -3257,8 +3257,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE("LexFunctionDeclaration");
|
||||
|
||||
TEST_SUITE("LexFunctionDeclaration") {
|
||||
TEST_CASE("simple") {
|
||||
std::string buffer_content = " void Foo(); ";
|
||||
lsPosition declaration = CharPos(buffer_content, 'F');
|
||||
@ -3350,11 +3349,9 @@ TEST_CASE("parameters") {
|
||||
REQUIRE(insert_text == "void Type::Foo(int a,\n\n int b) {\n}");
|
||||
REQUIRE(newlines_after_name == 2);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
|
||||
TEST_SUITE("LexWordAroundPos");
|
||||
|
||||
TEST_SUITE("LexWordAroundPos") {
|
||||
TEST_CASE("edges") {
|
||||
std::string content = "Foobar";
|
||||
REQUIRE(LexWordAroundPos(CharPos(content, 'F'), content) == "Foobar");
|
||||
@ -3387,11 +3384,9 @@ TEST_CASE("dot, dash, colon are skipped") {
|
||||
REQUIRE(LexWordAroundPos(CharPos(content, '2'), content) == "2");
|
||||
REQUIRE(LexWordAroundPos(CharPos(content, '3'), content) == "3");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
|
||||
TEST_SUITE("FindIncludeLine");
|
||||
|
||||
TEST_SUITE("FindIncludeLine") {
|
||||
TEST_CASE("in document") {
|
||||
std::vector<std::string> lines = {
|
||||
"#include <bbb>", // 0
|
||||
@ -3445,5 +3440,4 @@ TEST_CASE("ignore header") {
|
||||
REQUIRE(FindIncludeLine(lines, "#include <c>") == 6);
|
||||
REQUIRE(FindIncludeLine(lines, "#include <e>") == 7);
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
}
|
||||
|
@ -82,8 +82,6 @@ optional<std::string> ReadJsonRpcContentFrom(
|
||||
return content;
|
||||
}
|
||||
|
||||
TEST_SUITE("FindIncludeLine");
|
||||
|
||||
std::function<optional<char>()> MakeContentReader(std::string* content,
|
||||
bool can_be_empty) {
|
||||
return [content, can_be_empty]() -> optional<char> {
|
||||
@ -97,6 +95,7 @@ std::function<optional<char>()> MakeContentReader(std::string* content,
|
||||
};
|
||||
}
|
||||
|
||||
TEST_SUITE("FindIncludeLine") {
|
||||
TEST_CASE("ReadContentFromSource") {
|
||||
auto parse_correct = [](std::string content) -> std::string {
|
||||
auto reader = MakeContentReader(&content, false /*can_be_empty*/);
|
||||
@ -119,8 +118,7 @@ TEST_CASE("ReadContentFromSource") {
|
||||
REQUIRE(parse_incorrect("Content-Length: 5\r\n\r\nab") ==
|
||||
optional<std::string>());
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
}
|
||||
|
||||
optional<char> ReadCharFromStdinBlocking() {
|
||||
// Bad stdin means parent process has probably exited. Either way, cquery
|
||||
|
@ -213,8 +213,7 @@ bool SubstringMatch(const std::string& search, const std::string& content) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TEST_SUITE("Offset");
|
||||
|
||||
TEST_SUITE("Offset") {
|
||||
TEST_CASE("past end") {
|
||||
std::string content = "foo";
|
||||
int offset = GetOffsetForPosition(lsPosition(10, 10), content);
|
||||
@ -233,11 +232,9 @@ TEST_CASE("at end of content") {
|
||||
REQUIRE(GetOffsetForPosition(lsPosition(0, 0), "") == 0);
|
||||
REQUIRE(GetOffsetForPosition(lsPosition(0, 1), "a") == 1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
|
||||
TEST_SUITE("Substring");
|
||||
|
||||
TEST_SUITE("Substring") {
|
||||
TEST_CASE("match") {
|
||||
// Sanity.
|
||||
REQUIRE(SubstringMatch("a", "aa"));
|
||||
@ -267,5 +264,4 @@ TEST_CASE("match") {
|
||||
// Ordering.
|
||||
REQUIRE(!SubstringMatch("ad", "dcba"));
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
}
|
||||
|
@ -76,8 +76,7 @@ bool GroupMatch::IsMatch(const std::string& value,
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST_SUITE("Matcher");
|
||||
|
||||
TEST_SUITE("Matcher") {
|
||||
TEST_CASE("sanity") {
|
||||
// Matcher m("abc");
|
||||
// TODO: check case
|
||||
@ -87,5 +86,4 @@ TEST_CASE("sanity") {
|
||||
// CHECK(m.IsMatch("abcfoo"));
|
||||
// CHECK(m.IsMatch("11a11b11c11"));
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
}
|
||||
|
@ -87,8 +87,7 @@ void MakeDirectoryRecursive(std::string path) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE("Platform");
|
||||
|
||||
TEST_SUITE("Platform") {
|
||||
TEST_CASE("Split strings") {
|
||||
std::vector<std::string> actual = Split("/a/b/c/", '/');
|
||||
std::vector<std::string> expected{"a", "b", "c"};
|
||||
@ -122,5 +121,4 @@ TEST_CASE("Mutex lock/unlock (single process)") {
|
||||
t.join();
|
||||
REQUIRE(value == 1);
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
}
|
||||
|
@ -411,8 +411,7 @@ void Project::ForAllFilteredFiles(
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE("Project");
|
||||
|
||||
TEST_SUITE("Project") {
|
||||
void CheckFlags(const std::string& directory,
|
||||
const std::string& file,
|
||||
std::vector<std::string> raw,
|
||||
@ -1264,5 +1263,4 @@ TEST_CASE("Entry inference prefers same file endings") {
|
||||
REQUIRE(entry->args == std::vector<std::string>{"arg3"});
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
}
|
||||
|
@ -823,8 +823,7 @@ void QueryDatabase::UpdateDetailedNames(size_t* qualified_name_index,
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE("query");
|
||||
|
||||
TEST_SUITE("query") {
|
||||
IndexUpdate GetDelta(IndexFile previous, IndexFile current) {
|
||||
QueryDatabase db;
|
||||
IdMap previous_map(&db, previous.id_cache);
|
||||
@ -950,5 +949,4 @@ TEST_CASE("apply delta") {
|
||||
REQUIRE(db.funcs[0].callers[0].loc.range == Range(Position(4, 0)));
|
||||
REQUIRE(db.funcs[0].callers[1].loc.range == Range(Position(5, 0)));
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
}
|
||||
|
@ -379,14 +379,13 @@ std::vector<CXUnsavedFile> WorkingFiles::AsUnsavedFiles() {
|
||||
return result;
|
||||
}
|
||||
|
||||
TEST_SUITE("WorkingFile");
|
||||
|
||||
lsPosition CharPos(const WorkingFile& file,
|
||||
char character,
|
||||
int character_offset = 0) {
|
||||
return CharPos(file.buffer_content, character, character_offset);
|
||||
}
|
||||
|
||||
TEST_SUITE("WorkingFile") {
|
||||
TEST_CASE("simple call") {
|
||||
WorkingFile f("foo.cc", "abcd(1, 2");
|
||||
int active_param = 0;
|
||||
@ -481,5 +480,4 @@ TEST_CASE("existing completion underscore") {
|
||||
&existing_completion);
|
||||
REQUIRE(existing_completion == "ABC_");
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
}
|
||||
|
2
third_party/doctest
vendored
2
third_party/doctest
vendored
@ -1 +1 @@
|
||||
Subproject commit 11147357234d0166c9ec96c4d9e328464b884da3
|
||||
Subproject commit 79a379827251cd819c5286070834ccd0ac628af9
|
2
third_party/loguru
vendored
2
third_party/loguru
vendored
@ -1 +1 @@
|
||||
Subproject commit ac23215b4b9e878dfe5c2fd3d4afbf7a63cdad12
|
||||
Subproject commit 83b6f3c3d16e40453ec0d12d3baef42cd2f37c3b
|
2
third_party/rapidjson
vendored
2
third_party/rapidjson
vendored
@ -1 +1 @@
|
||||
Subproject commit 0163a53f4a1c72e6a05848a63d80eee0d8e3f387
|
||||
Subproject commit 17ae6ffa857173c25708e61610121bc908c0a6cd
|
2
third_party/sparsepp
vendored
2
third_party/sparsepp
vendored
@ -1 +1 @@
|
||||
Subproject commit b1d54fbe547cab3a13d181f16f1de758d6827f81
|
||||
Subproject commit bfb0de71ee7fa12a5f12c3ef61ce9f1d6d86d907
|
Loading…
Reference in New Issue
Block a user