[clang] 327d966 - clang-format: [JS] test case for numeric separators.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 6 10:01:37 PST 2021


Author: Martin Probst
Date: 2021-12-06T19:01:24+01:00
New Revision: 327d966365d7b34abd25a920e1f7b5aecfa5c70f

URL: https://github.com/llvm/llvm-project/commit/327d966365d7b34abd25a920e1f7b5aecfa5c70f
DIFF: https://github.com/llvm/llvm-project/commit/327d966365d7b34abd25a920e1f7b5aecfa5c70f.diff

LOG: clang-format: [JS] test case for numeric separators.

ES2021 allows numeric literals using `_` as a separator. This already
works, but had no test.

Differential Revision: https://reviews.llvm.org/D115147

Added: 
    

Modified: 
    clang/unittests/Format/FormatTestJS.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 0c8329dddd536..069b7b19e316e 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -2692,5 +2692,9 @@ TEST_F(FormatTestJS, NoBreakAfterAsserts) {
       "}\n");
 }
 
+TEST_F(FormatTestJS, NumericSeparators) {
+  verifyFormat("x = 1_000_000 + 12;", "x = 1_000_000   + 12;");
+}
+
 } // namespace format
 } // end namespace clang


        


More information about the cfe-commits mailing list