summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/CleanupTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/CleanupTest.cpp')
-rw-r--r--clang/unittests/Format/CleanupTest.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/unittests/Format/CleanupTest.cpp b/clang/unittests/Format/CleanupTest.cpp
index 0628c38a2bd..b0c81b509d2 100644
--- a/clang/unittests/Format/CleanupTest.cpp
+++ b/clang/unittests/Format/CleanupTest.cpp
@@ -183,10 +183,15 @@ TEST_F(CleanupTest, TrailingCommaInParens) {
std::string Code = "int main() { f(,1,,2,3,f(1,2,),4,,);}";
std::string Expected = "int main() { f(1,2,3,f(1,2),4);}";
EXPECT_EQ(Expected, cleanupAroundOffsets({15, 18, 29, 33}, Code));
+
+ // Lambda contents are also checked for trailing commas.
+ Code = "int main() { [](){f(,1,,2,3,f(1,2,),4,,);}();}";
+ Expected = "int main() { [](){f(1,2,3,f(1,2),4);}();}";
+ EXPECT_EQ(Expected, cleanupAroundOffsets({20, 23, 34, 38}, Code));
}
TEST_F(CleanupTest, TrailingCommaInBraces) {
- // Trainling comma is allowed in brace list.
+ // Trailing comma is allowed in brace list.
// If there was trailing comma in the original code, then trailing comma is
// preserved. In this example, element between the last two commas is deleted
// causing the second-last comma to be redundant.
@@ -194,7 +199,7 @@ TEST_F(CleanupTest, TrailingCommaInBraces) {
std::string Expected = "void f() { std::vector<int> v = {1,2,3,}; }";
EXPECT_EQ(Expected, cleanupAroundOffsets({39}, Code));
- // If there was no trailing comma in the original code, then trainling comma
+ // If there was no trailing comma in the original code, then trailing comma
// introduced by replacements should be cleaned up. In this example, the
// element after the last comma is deleted causing the last comma to be
// redundant.
OpenPOWER on IntegriCloud