summaryrefslogtreecommitdiffstats
path: root/clang/unittests
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-01-14 10:48:41 +0000
committerDaniel Jasper <djasper@google.com>2015-01-14 10:48:41 +0000
commite189d46512a710833f088bdd787458aecff71d21 (patch)
tree338e88a3757a09dd5c79de2d0502f324d2f26bb2 /clang/unittests
parent5a1391410d384fe221cb2abec95f0d63d77794de (diff)
downloadbcm5719-llvm-e189d46512a710833f088bdd787458aecff71d21.tar.gz
bcm5719-llvm-e189d46512a710833f088bdd787458aecff71d21.zip
clang-format: [Java] Support try blocks with resources.
Before: try (SomeResource rs = someFunction()) { Something(); } After: try (SomeResource rs = someFunction()) { Something(); } llvm-svn: 225973
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Format/FormatTestJava.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp
index af4199b46fc..8d6daa62a59 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/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"
OpenPOWER on IntegriCloud