--Line->Level;
}
while (FormatTok->is(tok::kw_catch) ||
- (Style.Language == FormatStyle::LK_JavaScript &&
+ ((Style.Language == FormatStyle::LK_Java ||
+ Style.Language == FormatStyle::LK_JavaScript) &&
FormatTok->TokenText == "finally")) {
nextToken();
while (FormatTok->isNot(tok::l_brace)) {
" + \"cde\";");
}
+TEST_F(FormatTestJava, TryCatchFinally) {
+ verifyFormat("try {\n"
+ " Something();\n"
+ "} catch (SomeException e) {\n"
+ " HandleException(e);\n"
+ "}");
+ verifyFormat("try {\n"
+ " Something();\n"
+ "} finally {\n"
+ " AlwaysDoThis();\n"
+ "}");
+ verifyFormat("try {\n"
+ " Something();\n"
+ "} catch (SomeException e) {\n"
+ " HandleException(e);\n"
+ "} finally {\n"
+ " AlwaysDoThis();\n"
+ "}");
+
+ verifyFormat("try {\n"
+ " Something();\n"
+ "} catch (SomeException | OtherException e) {\n"
+ " HandleException(e);\n"
+ "}");
+}
+
} // end namespace tooling
} // end namespace clang