Skip to content

Commit a9a4a83

Browse files
[clang-format] Add test to ensure formatting options docs are updated (#118154)
This patch adds a lit test to clang format to ensure that the ClangFormatStyleOptions doc page has been updated appropriately. The test just runs the automatic update script and diffs the outputs to ensure they are the same.
1 parent 6bec180 commit a9a4a83

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

clang/docs/tools/dump_format_style.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,5 +487,6 @@ class State:
487487

488488
contents = substitute(contents, "FORMAT_STYLE_OPTIONS", options_text)
489489

490-
with open(DOC_FILE, "wb") as output:
490+
output_file_path = sys.argv[1] if len(sys.argv) == 2 else DOC_FILE
491+
with open(output_file_path, "wb") as output:
491492
output.write(contents.encode())

clang/test/Format/docs_updated.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// RUN: %python %S/../../docs/tools/dump_format_style.py %t
2+
// RUN: diff %t %S/../../docs/ClangFormatStyleOptions.rst

clang/test/Format/lit.local.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ config.suffixes = [
1717
".textpb",
1818
".asciipb",
1919
".td",
20+
".test"
2021
]

0 commit comments

Comments
 (0)