summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-03-18 12:59:19 +0000
committerDaniel Jasper <djasper@google.com>2015-03-18 12:59:19 +0000
commit92e09829367109f038ccbbedbf376604a2e17e04 (patch)
tree3b903311afa54e0906a8c9515fb06b51bd9bb6ba
parentb1152f1e56349dc0c409abe5a8b83871431dc8e5 (diff)
downloadbcm5719-llvm-92e09829367109f038ccbbedbf376604a2e17e04.tar.gz
bcm5719-llvm-92e09829367109f038ccbbedbf376604a2e17e04.zip
[clang-format] Add missing test for std::function<void( int, int )>
spacing also fixed by r230473. The fix in r230473 was done to enable fixing the spacing for std::function<void( int, int )>. I did not realized that it also fixed this issue. Since it is fairly different from Deleted &operator=(const Deleted &)& = default; fixed in r230473, it seems sensible to add the regression test for it. Also cleaned up the test by removing duplicated code and comment, and kept repeated test set consistent. Result of running the new tests with r230473 backed out: [ RUN ] FormatTest.ConfigurableSpacesInParentheses Actual: "std::function<void(int, int)> callback;" Expected: "std::function<void( int, int )> callback;" Actual: "std::function<void( int, int )> callback;" Expected: "std::function<void(int, int)> callback;" Actual: "std::function<void( int, int ) > callback;" Expected: "std::function<void(int, int)> callback;" [ FAILED ] FormatTest.ConfigurableSpacesInParentheses (402 ms) Result of new tests with r230473: [ RUN ] FormatTest.ConfigurableSpacesInParentheses [ OK ] FormatTest.ConfigurableSpacesInParentheses (209 ms) Review: http://reviews.llvm.org/D7922 Patch by Jean-Philippe Dufraigne. Thanks! llvm-svn: 232632
-rw-r--r--clang/unittests/Format/FormatTest.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index c0e847fe67d..0b5babaf19a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -8197,6 +8197,8 @@ TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
Spaces.SpacesInParentheses = true;
verifyFormat("call( x, y, z );", Spaces);
+ verifyFormat("call();", Spaces);
+ verifyFormat("std::function<void( int, int )> callback;", Spaces);
verifyFormat("while ( (bool)1 )\n"
" continue;", Spaces);
verifyFormat("for ( ;; )\n"
@@ -8223,19 +8225,13 @@ TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
verifyFormat("my_int a = ( my_int )sizeof(int);", Spaces);
verifyFormat("#define x (( int )-1)", Spaces);
- Spaces.SpacesInParentheses = false;
- Spaces.SpaceInEmptyParentheses = true;
- verifyFormat("call(x, y, z);", Spaces);
- verifyFormat("call( )", Spaces);
-
- // Run the first set of tests again with
- // Spaces.SpacesInParentheses = false,
- // Spaces.SpaceInEmptyParentheses = true and
- // Spaces.SpacesInCStyleCastParentheses = true
+ // Run the first set of tests again with:
Spaces.SpacesInParentheses = false,
Spaces.SpaceInEmptyParentheses = true;
Spaces.SpacesInCStyleCastParentheses = true;
verifyFormat("call(x, y, z);", Spaces);
+ verifyFormat("call( );", Spaces);
+ verifyFormat("std::function<void(int, int)> callback;", Spaces);
verifyFormat("while (( bool )1)\n"
" continue;", Spaces);
verifyFormat("for (;;)\n"
@@ -8252,8 +8248,11 @@ TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
" break;\n"
"}", Spaces);
+ // Run the first set of tests again with:
Spaces.SpaceAfterCStyleCast = true;
verifyFormat("call(x, y, z);", Spaces);
+ verifyFormat("call( );", Spaces);
+ verifyFormat("std::function<void(int, int)> callback;", Spaces);
verifyFormat("while (( bool ) 1)\n"
" continue;",
Spaces);
@@ -8274,6 +8273,8 @@ TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
" break;\n"
"}",
Spaces);
+
+ // Run subset of tests again with:
Spaces.SpacesInCStyleCastParentheses = false;
Spaces.SpaceAfterCStyleCast = true;
verifyFormat("while ((bool) 1)\n"
OpenPOWER on IntegriCloud