[clang-tools-extra] b856952 - [clang-doc][NFC] Make test resilient to line changes (#119811)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 13 09:39:54 PST 2024
Author: Paul Kirth
Date: 2024-12-13T09:39:50-08:00
New Revision: b8569528865afec30b91f41cb2e670adea8f95bd
URL: https://github.com/llvm/llvm-project/commit/b8569528865afec30b91f41cb2e670adea8f95bd
DIFF: https://github.com/llvm/llvm-project/commit/b8569528865afec30b91f41cb2e670adea8f95bd.diff
LOG: [clang-doc][NFC] Make test resilient to line changes (#119811)
This just reorganizes the test code, so its easy to use @LINE directives
in the test, and avoid needing to update all the line numbers when
making unrelated changes.
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 d5a9e7d201e1e5..1adfbe0cf18282 100644
--- a/clang-tools-extra/test/clang-doc/templates.cpp
+++ b/clang-tools-extra/test/clang-doc/templates.cpp
@@ -6,22 +6,17 @@
// RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=YAML
// RUN: rm -rf %t
-template<typename T, int U = 1>
-void function(T x) {}
-
-template<>
-void function<bool, 0>(bool x) {}
+// YAML: ---
+// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
template<class... T>
void ParamPackFunction(T... args);
-// YAML: ---
-// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
// YAML-NEXT: ChildFunctions:
// YAML-NEXT: - USR: '{{([0-9A-F]{40})}}'
// YAML-NEXT: Name: 'ParamPackFunction'
// YAML-NEXT: Location:
-// YAML-NEXT: - LineNumber: 16
+// YAML-NEXT: - LineNumber: [[# @LINE - 6]]
// YAML-NEXT: Filename: '{{.*}}'
// YAML-NEXT: Params:
// YAML-NEXT: - Type:
@@ -35,10 +30,14 @@ void ParamPackFunction(T... args);
// YAML-NEXT: Template:
// YAML-NEXT: Params:
// YAML-NEXT: - Contents: 'class... T'
+
+template<typename T, int U = 1>
+void function(T x) {}
+
// YAML-NEXT: - USR: '{{([0-9A-F]{40})}}'
// YAML-NEXT: Name: 'function'
// YAML-NEXT: DefLocation:
-// YAML-NEXT: LineNumber: 10
+// YAML-NEXT: LineNumber: [[# @LINE - 5]]
// YAML-NEXT: Filename: '{{.*}}'
// YAML-NEXT: Params:
// YAML-NEXT: - Type:
@@ -53,10 +52,14 @@ void ParamPackFunction(T... args);
// YAML-NEXT: Params:
// YAML-NEXT: - Contents: 'typename T'
// YAML-NEXT: - Contents: 'int U = 1'
+
+template<>
+void function<bool, 0>(bool x) {}
+
// YAML-NEXT: - USR: '{{([0-9A-F]{40})}}'
// YAML-NEXT: Name: 'function'
// YAML-NEXT: DefLocation:
-// YAML-NEXT: LineNumber: 12
+// YAML-NEXT: LineNumber: [[# @LINE - 6]]
// YAML-NEXT: Filename: '{{.*}}'
// YAML-NEXT: Params:
// YAML-NEXT: - Type:
@@ -74,3 +77,4 @@ void ParamPackFunction(T... args);
// YAML-NEXT: - Contents: 'bool'
// YAML-NEXT: - Contents: '0'
// YAML-NEXT: ...
+
More information about the cfe-commits
mailing list