diff options
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 094db349ae1..650636b7633 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -11936,6 +11936,21 @@ TEST_F(FormatTest, FormatsLambdas) { "// broken:\n" "auto foo{[]() -> foo<2 ? 1 : 0> { return {}; }};\n" "} // namespace bar"); + verifyFormat("[]() -> a<1> {};"); + verifyFormat("[]() -> a<1> { ; };"); + verifyFormat("[]() -> a<1> { ; }();"); + verifyFormat("[a, a]() -> a<true> {};"); + verifyFormat("[]() -> a<true> {};"); + verifyFormat("[]() -> a<true> { ; };"); + verifyFormat("[]() -> a<true> { ; }();"); + verifyFormat("[a, a]() -> a<false> {};"); + verifyFormat("[]() -> a<false> {};"); + verifyFormat("[]() -> a<false> { ; };"); + verifyFormat("[]() -> a<false> { ; }();"); + verifyFormat("auto foo{[]() -> foo<false> { ; }};"); + verifyFormat("namespace bar {\n" + "auto foo{[]() -> foo<false> { ; }};\n" + "} // namespace bar"); verifyFormat("auto aaaaaaaa = [](int i, // break for some reason\n" " int j) -> int {\n" " return ffffffffffffffffffffffffffffffffffffffffffff(i * j);\n" |