diff options
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 0f9f38240a3..888d73d48ee 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -521,6 +521,18 @@ TEST_F(FormatTestJS, ReturnStatements) { "}"); } +TEST_F(FormatTestJS, AutomaticSemicolonInsertion) { + // The following statements must not wrap, as otherwise the program meaning + // would change due to automatic semicolon insertion. + // See http://www.ecma-international.org/ecma-262/5.1/#sec-7.9.1. + verifyFormat("return aaaaa;", getGoogleJSStyleWithColumns(10)); + verifyFormat("continue aaaaa;", getGoogleJSStyleWithColumns(10)); + verifyFormat("break aaaaa;", getGoogleJSStyleWithColumns(10)); + verifyFormat("throw aaaaa;", getGoogleJSStyleWithColumns(10)); + verifyFormat("aaaaaaaaa++;", getGoogleJSStyleWithColumns(10)); + verifyFormat("aaaaaaaaa--;", getGoogleJSStyleWithColumns(10)); +} + TEST_F(FormatTestJS, ClosureStyleCasts) { verifyFormat("var x = /** @type {foo} */ (bar);"); } |