From 809d5ecae77e35d2daa4e6e367b9778fc00e6f2d Mon Sep 17 00:00:00 2001 From: ykiko Date: Sun, 8 Dec 2024 15:21:27 +0800 Subject: [PATCH] Clear namespace. --- unittests/Basic/URI.cpp | 6 ++++-- unittests/Compiler/Compiler.cpp | 7 +++++-- unittests/Compiler/Resolver.cpp | 8 ++++---- unittests/Feature/CodeCompletion.cpp | 10 +++++----- unittests/Server/Async.cpp | 7 +++++-- unittests/Support/JSON.cpp | 4 ++-- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/unittests/Basic/URI.cpp b/unittests/Basic/URI.cpp index 4a1fc148..344889fa 100644 --- a/unittests/Basic/URI.cpp +++ b/unittests/Basic/URI.cpp @@ -1,9 +1,9 @@ #include #include -namespace { +namespace clice { -using namespace clice; +namespace { TEST(URITest, ConstructorAndAccessors) { URI uri("https", "reviews.llvm.org", "/D41946"); @@ -43,3 +43,5 @@ TEST(URITest, ParseFunction) { } // namespace +} // namespace clice + diff --git a/unittests/Compiler/Compiler.cpp b/unittests/Compiler/Compiler.cpp index 7d9cbfd0..0a8a198b 100644 --- a/unittests/Compiler/Compiler.cpp +++ b/unittests/Compiler/Compiler.cpp @@ -2,9 +2,9 @@ #include "Compiler/Compiler.h" #include -namespace { +namespace clice { -using namespace clice; +namespace { TEST(Compiler, buildAST) { const char* code = R"cpp( @@ -223,3 +223,6 @@ export int foo = 1; } } // namespace + +} // namespace clice + diff --git a/unittests/Compiler/Resolver.cpp b/unittests/Compiler/Resolver.cpp index cee95c1f..0e9d95f3 100644 --- a/unittests/Compiler/Resolver.cpp +++ b/unittests/Compiler/Resolver.cpp @@ -2,12 +2,10 @@ #include #include +namespace clice { + namespace { -using namespace clice; - -namespace testing {} // namespace testing - struct TemplateResolverTester : public clang::RecursiveASTVisitor { TemplateResolverTester(llvm::StringRef code) { compileArgs = { @@ -485,3 +483,5 @@ struct test { } // namespace +} // namespace clice + diff --git a/unittests/Feature/CodeCompletion.cpp b/unittests/Feature/CodeCompletion.cpp index 2ca48f82..ef4150c1 100644 --- a/unittests/Feature/CodeCompletion.cpp +++ b/unittests/Feature/CodeCompletion.cpp @@ -1,12 +1,9 @@ #include "../Test.h" -#include "Compiler/Compiler.h" -#include "Support/Support.h" - #include "Feature/CodeCompletion.h" -namespace { +namespace clice { -using namespace clice; +namespace { TEST(Feature, CodeCompletion) { const char* code = R"cpp( @@ -41,3 +38,6 @@ int main() { } } // namespace + +} // namespace clice + diff --git a/unittests/Server/Async.cpp b/unittests/Server/Async.cpp index 12aa8dad..aa94e130 100644 --- a/unittests/Server/Async.cpp +++ b/unittests/Server/Async.cpp @@ -1,9 +1,9 @@ #include "../Test.h" #include "Server/Async.h" -namespace { +namespace clice { -using namespace clice; +namespace { async::promise add(int a, int b) { co_return a + b; @@ -23,3 +23,6 @@ TEST(clice, coroutine) { } } // namespace + +} // namespace clice + diff --git a/unittests/Support/JSON.cpp b/unittests/Support/JSON.cpp index a3ffe883..b020aac9 100644 --- a/unittests/Support/JSON.cpp +++ b/unittests/Support/JSON.cpp @@ -38,11 +38,11 @@ TEST(Support, JSON) { {"y", 2}, }; - auto point = clice::json::deserialize(std::move(object)); + auto point = json::deserialize(std::move(object)); ASSERT_EQ(point.x, 1); ASSERT_EQ(point.y, 2); - auto result = clice::json::serialize(point); + auto result = json::serialize(point); ASSERT_EQ(result, object); }