Skip to content

Commit eeadd01

Browse files
committed
[clang-format] Also check ClangFormat.rst is up to date in docs_updated.test
1 parent d31fb26 commit eeadd01

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

clang/docs/tools/dump_format_help.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def validate(text, columns):
5757

5858
p = argparse.ArgumentParser()
5959
p.add_argument("-d", "--directory", help="directory of clang-format")
60+
p.add_argument("-o", "--output", help="path of output file")
6061
opts = p.parse_args()
6162

6263
binary = "clang-format"
@@ -66,10 +67,10 @@ def validate(text, columns):
6667
help_text = get_help_text()
6768
validate(help_text, 100)
6869

69-
with open(DOC_FILE) as f:
70+
with open(DOC_FILE, encoding="utf-8") as f:
7071
contents = f.read()
7172

7273
contents = substitute(contents, "FORMAT_HELP", help_text)
7374

74-
with open(DOC_FILE, "wb") as output:
75+
with open(opts.output if opts.output else DOC_FILE, "wb") as output:
7576
output.write(contents.encode())

clang/test/Format/docs_updated.test

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
// RUN: %python %S/../../docs/tools/dump_format_style.py %t
2-
// RUN: diff %t %S/../../docs/ClangFormatStyleOptions.rst
1+
// RUN: %python %S/../../docs/tools/dump_format_style.py %t.style
2+
// RUN: diff %t.style %S/../../docs/ClangFormatStyleOptions.rst
3+
4+
// RUN: %python %S/../../docs/tools/dump_format_help.py -o %t.help
5+
// RUN: diff %t.help %S/../../docs/ClangFormat.rst

0 commit comments

Comments
 (0)