summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index d63a24d8056..8538a7d94a8 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -600,6 +600,13 @@ TEST_F(FormatTestJS, RegexLiteralClassification) {
// Not regex literals.
verifyFormat("var a = a / 2 + b / 3;");
+ verifyFormat("var a = a++ / 2;");
+ // Prefix unary can operate on regex literals, not that it makes sense.
+ verifyFormat("var a = ++/a/;");
+
+ // This is a known issue, regular expressions are incorrectly detected if
+ // directly following a closing parenthesis.
+ verifyFormat("if (foo) / bar /.exec(baz);");
}
TEST_F(FormatTestJS, RegexLiteralSpecialCharacters) {
@@ -625,6 +632,9 @@ TEST_F(FormatTestJS, RegexLiteralSpecialCharacters) {
verifyFormat("var regex = /[\\/]/;");
verifyFormat("var regex = /\\[/;");
verifyFormat("var regex = /\\\\[/]/;");
+ verifyFormat("var regex = /}[\"]/;");
+ verifyFormat("var regex = /}[/\"]/;");
+ verifyFormat("var regex = /}[\"/]/;");
verifyFormat("var regex = /\\b/;");
verifyFormat("var regex = /\\B/;");
OpenPOWER on IntegriCloud