summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-10-29 16:51:38 +0000
committerDaniel Jasper <djasper@google.com>2014-10-29 16:51:38 +0000
commit49a9a2833bfde8ece89c80f19c8175b6bb70e7b2 (patch)
treedfe465bf8983846fa81659013f558c0810657704 /clang/unittests/Format
parenta25fbef08857ff0991877bb11e69a25943406915 (diff)
downloadbcm5719-llvm-49a9a2833bfde8ece89c80f19c8175b6bb70e7b2.tar.gz
bcm5719-llvm-49a9a2833bfde8ece89c80f19c8175b6bb70e7b2.zip
clang-format: [JS] Support more regex literals.
Previously a regex-literal containing "/*" would through clang-format off, e.g.: var regex = /\/*$/; Would lead to none of the following code to be formatted. llvm-svn: 220860
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index bc9bbad6017..6ee150c6624 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -408,6 +408,10 @@ TEST_F(FormatTestJS, RegexLiteralSpecialCharacters) {
verifyFormat("var regex = /\a\\//g;");
verifyFormat("var regex = /a\\//;\n"
"var x = 0;");
+ EXPECT_EQ("var regex = /\\/*/;\n"
+ "var x = 0;",
+ format("var regex = /\\/*/;\n"
+ "var x=0;"));
}
TEST_F(FormatTestJS, RegexLiteralModifiers) {
OpenPOWER on IntegriCloud