summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-10-12 03:13:48 +0000
committerDaniel Jasper <djasper@google.com>2015-10-12 03:13:48 +0000
commit8d0e223498ab523a7668a5e2f3b0cb4849678347 (patch)
tree3cd45674fcb88cb96ad5ea4db229b704e6d4e404 /clang/unittests/Format/FormatTestJS.cpp
parentd79eec97fcfeac61cd4f8d38dd4d6ce27ee4a36c (diff)
downloadbcm5719-llvm-8d0e223498ab523a7668a5e2f3b0cb4849678347.tar.gz
bcm5719-llvm-8d0e223498ab523a7668a5e2f3b0cb4849678347.zip
clang-format: [JS] handle character classes in regexes.
Slashes in regular expressions do not need to be escaped and do not terminate the regular expression even without a preceding backslash. Patch by Martin Probst. Thank you. llvm-svn: 250009
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index f09df281429..d63a24d8056 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -617,9 +617,15 @@ TEST_F(FormatTestJS, RegexLiteralSpecialCharacters) {
verifyFormat("var regex = /x|y/;");
verifyFormat("var regex = /a{2}/;");
verifyFormat("var regex = /a{1,3}/;");
+
verifyFormat("var regex = /[abc]/;");
verifyFormat("var regex = /[^abc]/;");
verifyFormat("var regex = /[\\b]/;");
+ verifyFormat("var regex = /[/]/;");
+ verifyFormat("var regex = /[\\/]/;");
+ verifyFormat("var regex = /\\[/;");
+ verifyFormat("var regex = /\\\\[/]/;");
+
verifyFormat("var regex = /\\b/;");
verifyFormat("var regex = /\\B/;");
verifyFormat("var regex = /\\d/;");
OpenPOWER on IntegriCloud