[PATCH] clang-format: [JS] tests for automatic semicolon insertion.
Martin Probst
martinprobst at google.com
Thu Jun 11 21:57:07 PDT 2015
Hi djasper,
Add tests to ensure clang-format doesn't break code by triggering automatic semicolon insertion changes.
NFC intended.
http://reviews.llvm.org/D10409
Files:
unittests/Format/FormatTestJS.cpp
Index: unittests/Format/FormatTestJS.cpp
===================================================================
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -521,6 +521,18 @@
"}");
}
+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);");
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10409.27564.patch
Type: text/x-patch
Size: 996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150612/ff1751fb/attachment.bin>
More information about the cfe-commits
mailing list