[clang-tools-extra] 734da23 - [clangd] Dont assert on specific uris for diagnostics docs
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 4 02:10:01 PDT 2023
Author: Kadir Cetinkaya
Date: 2023-08-04T11:09:19+02:00
New Revision: 734da23e21eb687ff4a613d520cbef5348e26a65
URL: https://github.com/llvm/llvm-project/commit/734da23e21eb687ff4a613d520cbef5348e26a65
DIFF: https://github.com/llvm/llvm-project/commit/734da23e21eb687ff4a613d520cbef5348e26a65.diff
LOG: [clangd] Dont assert on specific uris for diagnostics docs
To enable customization of links in downstream projects without
breaking tests (and also ease of pointing at different links in the future).
Just check for existence instead.
Differential Revision: https://reviews.llvm.org/D157071
Added:
Modified:
clang-tools-extra/clangd/test/include-cleaner-batch-fix.test
clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/test/include-cleaner-batch-fix.test b/clang-tools-extra/clangd/test/include-cleaner-batch-fix.test
index bf9e5abca83312..72d69ec0d49415 100644
--- a/clang-tools-extra/clangd/test/include-cleaner-batch-fix.test
+++ b/clang-tools-extra/clangd/test/include-cleaner-batch-fix.test
@@ -34,7 +34,7 @@
# CHECK-NEXT: {
# CHECK-NEXT: "code": "missing-includes",
# CHECK-NEXT: "codeDescription": {
-# CHECK-NEXT: "href": "https://clangd.llvm.org/guides/include-cleaner"
+# CHECK-NEXT: "href": "{{.*}}"
# CHECK-NEXT: },
# CHECK-NEXT: "message": "No header providing \"Foo\" is directly included (fixes available)",
# CHECK-NEXT: "range": {
@@ -53,7 +53,7 @@
# CHECK-NEXT: {
# CHECK-NEXT: "code": "missing-includes",
# CHECK-NEXT: "codeDescription": {
-# CHECK-NEXT: "href": "https://clangd.llvm.org/guides/include-cleaner"
+# CHECK-NEXT: "href": "{{.*}}"
# CHECK-NEXT: },
# CHECK-NEXT: "message": "No header providing \"Bar\" is directly included (fixes available)",
# CHECK-NEXT: "range": {
@@ -72,7 +72,7 @@
# CHECK-NEXT: {
# CHECK-NEXT: "code": "unused-includes",
# CHECK-NEXT: "codeDescription": {
-# CHECK-NEXT: "href": "https://clangd.llvm.org/guides/include-cleaner"
+# CHECK-NEXT: "href": "{{.*}}"
# CHECK-NEXT: },
# CHECK-NEXT: "message": "Included header all1.h is not used directly (fixes available)",
# CHECK-NEXT: "range": {
@@ -94,7 +94,7 @@
# CHECK-NEXT: {
# CHECK-NEXT: "code": "unused-includes",
# CHECK-NEXT: "codeDescription": {
-# CHECK-NEXT: "href": "https://clangd.llvm.org/guides/include-cleaner"
+# CHECK-NEXT: "href": "{{.*}}"
# CHECK-NEXT: },
# CHECK-NEXT: "message": "Included header all2.h is not used directly (fixes available)",
# CHECK-NEXT: "range": {
diff --git a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
index 51ffa45dbc8f6f..f9b71a32304f21 100644
--- a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -34,6 +34,7 @@
#include "llvm/Support/JSON.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/TargetSelect.h"
+#include "llvm/Testing/Support/SupportHelpers.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cstddef>
@@ -1961,8 +1962,8 @@ TEST(DiagnosticsTest, IncludeCleaner) {
withTag(DiagnosticTag::Unnecessary), diagSource(Diag::Clangd),
withFix(Fix(Test.range("fix"), "", "remove #include directive")))));
auto &Diag = AST.getDiagnostics().front();
- EXPECT_EQ(getDiagnosticDocURI(Diag.Source, Diag.ID, Diag.Name),
- std::string("https://clangd.llvm.org/guides/include-cleaner"));
+ EXPECT_THAT(getDiagnosticDocURI(Diag.Source, Diag.ID, Diag.Name),
+ llvm::ValueIs(Not(IsEmpty())));
Cfg.Diagnostics.SuppressAll = true;
WithContextValue SuppressAllWithCfg(Config::Key, std::move(Cfg));
EXPECT_THAT(TU.build().getDiagnostics(), IsEmpty());
More information about the cfe-commits
mailing list