[clang-tools-extra] [clang-doc] [feat] add --repository-line-prefix argument (PR #131280)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 22 13:16:13 PDT 2025
================
@@ -276,6 +286,62 @@
// HTML-CIRCLE: <div>return</div>
// HTML-CIRCLE: <p> double The perimeter of the circle.</p>
+// HTML-SHAPE-PREFIX: <h1>class Shape</h1>
+// HTML-SHAPE-PREFIX-NEXT: <p>
+// HTML-SHAPE-PREFIX-NEXT: Defined at line
+// HTML-SHAPE-PREFIX-NEXT: <a href="https://repository.com/./include/Shape.h#L8">8</a>
+// HTML-SHAPE-PREFIX-NEXT: of file
+// HTML-SHAPE-PREFIX-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
+// HTML-SHAPE-PREFIX-NEXT: </p>
+// HTML-SHAPE-PREFIX: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
+// HTML-SHAPE-PREFIX: <p>public void ~Shape()</p>
+// HTML-SHAPE-PREFIX: Defined at line
+// HTML-SHAPE-PREFIX-NEXT: <a href="https://repository.com/./include/Shape.h#L13">13</a>
+// HTML-SHAPE-PREFIX-NEXT: of file
+// HTML-SHAPE-PREFIX-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
----------------
ilovepi wrote:
Isn't this the exact same checks as done for HTML-SHAPE, except that the URL for the line is different?
In those cases, we usually have a common set of checks that can serve for both, and then a separate check for the lines that differ. This is how we handled it for the REPOSITORY/NO-REPOSITORY checks. If you look above, we use HTML-CIRCLE to test the common logic, and then only use CIRCLE-NO-REPOSITORY and CIRCLE-REPOSITORY prefixes when the behavior diverges. You should follow that pattern instead of duplicating the entire test. Since we already independently check the behavior w/ repository, you could just use the HTML-CIRCLE + HTML-CIRCLE-PREFIX and ignore matching additional lines beyond the lines w/ actual prefixes.
https://llvm.org/docs/TestingGuide.html has a lot of info on our testing practices.
https://maskray.me/blog/2021-08-08-toolchain-testing is a great post about testing toolchains.
https://github.com/llvm/llvm-project/pull/131280
More information about the cfe-commits
mailing list