Author: Aiden Grossman
Date: 2024-12-04T23:41:12-08:00
New Revision: a9a4a83b6132f076fd14ac31268deaa4bf1381d5

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

LOG: [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.

Added: 
    clang/test/Format/docs_updated.test

Modified: 
    clang/docs/tools/dump_format_style.py
    clang/test/Format/lit.local.cfg

Removed: 
    


################################################################################
diff  --git a/clang/docs/tools/dump_format_style.py 
b/clang/docs/tools/dump_format_style.py
index af0e658fcdc55d..c82b4479f299d9 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -487,5 +487,6 @@ class State:
 
 contents = substitute(contents, "FORMAT_STYLE_OPTIONS", options_text)
 
-with open(DOC_FILE, "wb") as output:
+output_file_path = sys.argv[1] if len(sys.argv) == 2 else DOC_FILE
+with open(output_file_path, "wb") as output:
     output.write(contents.encode())

diff  --git a/clang/test/Format/docs_updated.test 
b/clang/test/Format/docs_updated.test
new file mode 100644
index 00000000000000..fe2e4f1bd13a1b
--- /dev/null
+++ b/clang/test/Format/docs_updated.test
@@ -0,0 +1,2 @@
+// RUN: %python %S/../../docs/tools/dump_format_style.py %t
+// RUN: 
diff  %t %S/../../docs/ClangFormatStyleOptions.rst

diff  --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index 3eb0f54ceaa6f9..8acf02725d701b 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -17,4 +17,5 @@ config.suffixes = [
     ".textpb",
     ".asciipb",
     ".td",
+    ".test"
 ]


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

Reply via email to