https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/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. >From cd2bb137cb9f895c7dc655258484671636ca4768 Mon Sep 17 00:00:00 2001 From: Aiden Grossman <aidengross...@google.com> Date: Sat, 30 Nov 2024 06:12:07 +0000 Subject: [PATCH] [clang-format] Add test to ensure formatting options docs are updated 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. --- clang/docs/tools/dump_format_style.py | 3 ++- clang/test/Format/docs_updated.test | 2 ++ clang/test/Format/lit.local.cfg | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 clang/test/Format/docs_updated.test 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