diff options
| author | Hannes Braun <hannes@hannesbraun.net> | 2025-11-05 20:55:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-05 20:55:32 +0100 |
| commit | 6c4f9688082361a5c5d57aa1e6d368dfc4aeea75 (patch) | |
| tree | c8a658398ea65c85c3598af5abc17ccc257c6245 /clang/unittests/Format/FormatTestJava.cpp | |
| parent | db6231b4c2e18bb5fc107624e9c9071b02124844 (diff) | |
| download | llvm-6c4f9688082361a5c5d57aa1e6d368dfc4aeea75.zip llvm-6c4f9688082361a5c5d57aa1e6d368dfc4aeea75.tar.gz llvm-6c4f9688082361a5c5d57aa1e6d368dfc4aeea75.tar.bz2 | |
[clang-format] Fix brace wrapping for Java records (#164711)
The brace wrapping for Java records should now behave similar to
classes. Before, opening braces for Java records were always placed in
the same line as the record definition.
Diffstat (limited to 'clang/unittests/Format/FormatTestJava.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTestJava.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp index 1416614b..3cc97e2 100644 --- a/clang/unittests/Format/FormatTestJava.cpp +++ b/clang/unittests/Format/FormatTestJava.cpp @@ -848,6 +848,19 @@ TEST_F(FormatTestJava, TextBlock) { " Pat Q. Smith"); } +TEST_F(FormatTestJava, BreakAfterRecord) { + auto Style = getLLVMStyle(FormatStyle::LK_Java); + Style.EmptyLineBeforeAccessModifier = FormatStyle::ELBAMS_Never; + Style.BreakBeforeBraces = FormatStyle::BS_Custom; + Style.BraceWrapping.AfterClass = true; + Style.BraceWrapping.SplitEmptyRecord = true; + + verifyFormat("public record Foo(int i)\n" + "{\n" + "}", + "public record Foo(int i) {}", Style); +} + } // namespace } // namespace test } // namespace format |
