[clang] eeadd01 - [clang-format] Also check ClangFormat.rst is up to date in docs_updated.test
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 8 01:15:53 PST 2024
Author: Owen Pan
Date: 2024-12-08T01:15:45-08:00
New Revision: eeadd0128df848eb858ae718984a13fa2c923775
URL: https://github.com/llvm/llvm-project/commit/eeadd0128df848eb858ae718984a13fa2c923775
DIFF: https://github.com/llvm/llvm-project/commit/eeadd0128df848eb858ae718984a13fa2c923775.diff
LOG: [clang-format] Also check ClangFormat.rst is up to date in docs_updated.test
Added:
Modified:
clang/docs/tools/dump_format_help.py
clang/test/Format/docs_updated.test
Removed:
################################################################################
diff --git a/clang/docs/tools/dump_format_help.py b/clang/docs/tools/dump_format_help.py
index a9893b3f91457a..baf90048ee1352 100755
--- a/clang/docs/tools/dump_format_help.py
+++ b/clang/docs/tools/dump_format_help.py
@@ -57,6 +57,7 @@ def validate(text, columns):
p = argparse.ArgumentParser()
p.add_argument("-d", "--directory", help="directory of clang-format")
+p.add_argument("-o", "--output", help="path of output file")
opts = p.parse_args()
binary = "clang-format"
@@ -66,10 +67,10 @@ def validate(text, columns):
help_text = get_help_text()
validate(help_text, 100)
-with open(DOC_FILE) as f:
+with open(DOC_FILE, encoding="utf-8") as f:
contents = f.read()
contents = substitute(contents, "FORMAT_HELP", help_text)
-with open(DOC_FILE, "wb") as output:
+with open(opts.output if opts.output else DOC_FILE, "wb") as output:
output.write(contents.encode())
diff --git a/clang/test/Format/docs_updated.test b/clang/test/Format/docs_updated.test
index fe2e4f1bd13a1b..56ca4d13eb375c 100644
--- a/clang/test/Format/docs_updated.test
+++ b/clang/test/Format/docs_updated.test
@@ -1,2 +1,5 @@
-// RUN: %python %S/../../docs/tools/dump_format_style.py %t
-// RUN:
diff %t %S/../../docs/ClangFormatStyleOptions.rst
+// RUN: %python %S/../../docs/tools/dump_format_style.py %t.style
+// RUN:
diff %t.style %S/../../docs/ClangFormatStyleOptions.rst
+
+// RUN: %python %S/../../docs/tools/dump_format_help.py -o %t.help
+// RUN:
diff %t.help %S/../../docs/ClangFormat.rst
More information about the cfe-commits
mailing list