Author: Paul Kirth
Date: 2024-12-13T09:53:29-08:00
New Revision: 52e25912f875dfddef212ec9152ed86057d5d618

URL: 
https://github.com/llvm/llvm-project/commit/52e25912f875dfddef212ec9152ed86057d5d618
DIFF: 
https://github.com/llvm/llvm-project/commit/52e25912f875dfddef212ec9152ed86057d5d618.diff

LOG: [clang-doc] Add tests for Markdown output with C++ templates



Reviewers: PeterChou1, petrhosek

Reviewed By: petrhosek

Pull Request: https://github.com/llvm/llvm-project/pull/119813

Added: 
    

Modified: 
    clang-tools-extra/test/clang-doc/templates.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/clang-doc/templates.cpp 
b/clang-tools-extra/test/clang-doc/templates.cpp
index 05a3dab71f48a1..5ca8768cbdc43c 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,7 @@ 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]]*
+


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to