[PATCH] D157071: [clangd] Dont assert on specific uris for diagnostics docs
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 3 23:05:34 PDT 2023
kadircet created this revision.
kadircet added a reviewer: hokein.
Herald added a subscriber: arphaman.
Herald added a project: All.
kadircet requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D157071
Files:
clang-tools-extra/clangd/test/include-cleaner-batch-fix.test
clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ 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 @@
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());
Index: clang-tools-extra/clangd/test/include-cleaner-batch-fix.test
===================================================================
--- clang-tools-extra/clangd/test/include-cleaner-batch-fix.test
+++ 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": {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157071.547106.patch
Type: text/x-patch
Size: 3100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230804/3b3fa19c/attachment.bin>
More information about the cfe-commits
mailing list