Skip to content

[clang-doc] Add tests for Markdown output with C++ templates #119813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Dec 13, 2024

No description provided.

Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2024

@llvm/pr-subscribers-clang-tools-extra

Author: Paul Kirth (ilovepi)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/119813.diff

1 Files Affected:

  • (modified) clang-tools-extra/test/clang-doc/templates.cpp (+19)
diff --git a/clang-tools-extra/test/clang-doc/templates.cpp b/clang-tools-extra/test/clang-doc/templates.cpp
index 05a3dab71f48a1..536b24161990aa 100644
--- a/clang-tools-extra/test/clang-doc/templates.cpp
+++ b/clang-tools-extra/test/clang-doc/templates.cpp
@@ -1,11 +1,18 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
+
 // RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs
 // RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=YAML
 
+// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs --format=md
+// RUN: cat %t/docs/GlobalNamespace/index.md | FileCheck %s --check-prefix=MD
+
 // YAML: ---
 // YAML-NEXT: USR:             '{{([0-9A-F]{40})}}'
 
+// MD: # Global Namespace
+// MD: ## Functions
+
 template<class... T>
 void ParamPackFunction(T... args);
 
@@ -28,6 +35,9 @@ void ParamPackFunction(T... args);
 // YAML-NEXT:      Params:
 // YAML-NEXT:        - Contents:        'class... T'
 
+// MD: ### ParamPackFunction
+// MD: *void ParamPackFunction(T... args)*
+
 template<typename T, int U = 1>
 void function(T x) {}
 
@@ -50,6 +60,10 @@ void function(T x) {}
 // YAML-NEXT:         - Contents:        'typename T'
 // YAML-NEXT:         - Contents:        'int U = 1'
 
+// MD: ### function
+// MD: *void function(T x)*
+// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 23]]*
+
 template<>
 void function<bool, 0>(bool x) {}
 
@@ -75,3 +89,8 @@ void function<bool, 0>(bool x) {}
 // YAML-NEXT:           - Contents:        '0'
 // YAML-NEXT: ...
 
+// MD: ### function
+// MD: *void function(_Bool x)*
+// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 27]]*
+
+

Comment on lines 95 to 96


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: These extra empty lines shouldn't be needed.

Suggested change

Created using spr 1.3.6-beta.1
@ilovepi ilovepi changed the base branch from users/ilovepi/spr/main.clang-doc-add-tests-for-markdown-output-with-c-templates to main December 13, 2024 17:40
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@ilovepi ilovepi changed the base branch from main to users/ilovepi/spr/main.clang-doc-add-tests-for-markdown-output-with-c-templates-1 December 13, 2024 17:48
@ilovepi ilovepi changed the base branch from users/ilovepi/spr/main.clang-doc-add-tests-for-markdown-output-with-c-templates-1 to main December 13, 2024 17:50
Created using spr 1.3.6-beta.1
@ilovepi ilovepi merged commit 52e2591 into main Dec 13, 2024
5 of 6 checks passed
@ilovepi ilovepi deleted the users/ilovepi/spr/clang-doc-add-tests-for-markdown-output-with-c-templates branch December 13, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants