diff options
author | Daniel Jasper <djasper@google.com> | 2015-01-14 10:48:41 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-01-14 10:48:41 +0000 |
commit | 3e3c5ba7b8be117ee3d12afebbd8d1d28b417dc0 (patch) | |
tree | af27bf0c91a29c205b8ce197d5e093cc96d85a39 /unittests/Format/FormatTestJava.cpp | |
parent | 56deac07d749e15ccca466656267f5c4331ceb19 (diff) |
clang-format: [Java] Support try blocks with resources.
Before:
try
(SomeResource rs = someFunction()) {
Something();
}
After:
try (SomeResource rs = someFunction()) {
Something();
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTestJava.cpp')
-rw-r--r-- | unittests/Format/FormatTestJava.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestJava.cpp b/unittests/Format/FormatTestJava.cpp index af4199b46f..8d6daa62a5 100644 --- a/unittests/Format/FormatTestJava.cpp +++ b/unittests/Format/FormatTestJava.cpp @@ -361,6 +361,17 @@ TEST_F(FormatTestJava, TryCatchFinally) { "}"); } +TEST_F(FormatTestJava, TryWithResources) { + verifyFormat("try (SomeResource rs = someFunction()) {\n" + " Something();\n" + "}"); + verifyFormat("try (SomeResource rs = someFunction()) {\n" + " Something();\n" + "} catch (SomeException e) {\n" + " HandleException(e);\n" + "}"); +} + TEST_F(FormatTestJava, SynchronizedKeyword) { verifyFormat("synchronized (mData) {\n" " // ...\n" |