summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorReuben Thomas <reuben.thomas@me.com>2019-04-08 12:54:48 +0000
committerReuben Thomas <reuben.thomas@me.com>2019-04-08 12:54:48 +0000
commit91f60b44958fbcaf6450e82ef40965e92aedda5f (patch)
treef56eb0ee89c5c4ff7d62a2b1fbbab17959ba29bf /clang/unittests/Format/FormatTest.cpp
parentb743b45ebf1bc0b62cde614e334ef44cfbc9926e (diff)
downloadbcm5719-llvm-91f60b44958fbcaf6450e82ef40965e92aedda5f.tar.gz
bcm5719-llvm-91f60b44958fbcaf6450e82ef40965e92aedda5f.zip
[clang-format] Optionally insert a space after unary ! operator
llvm-svn: 357908
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 3256ea54ab6..1839172047e 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -9719,6 +9719,17 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) {
verifyFormat("auto lambda = []() { return 0; };", SomeSpace);
}
+TEST_F(FormatTest, SpaceAfterLogicalNot) {
+ FormatStyle Spaces = getLLVMStyle();
+ Spaces.SpaceAfterLogicalNot = true;
+
+ verifyFormat("bool x = ! y", Spaces);
+ verifyFormat("if (! isFailure())", Spaces);
+ verifyFormat("if (! (a && b))", Spaces);
+ verifyFormat("\"Error!\"", Spaces);
+ verifyFormat("! ! x", Spaces);
+}
+
TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
FormatStyle Spaces = getLLVMStyle();
@@ -11511,6 +11522,12 @@ TEST_F(FormatTest, ParsesConfiguration) {
CHECK_PARSE("SpaceAfterControlStatementKeyword: true", SpaceBeforeParens,
FormatStyle::SBPO_ControlStatements);
+ Style.SpaceAfterLogicalNot = false;
+ CHECK_PARSE("SpaceAfterLogicalNot: true", SpaceAfterLogicalNot,
+ true);
+ CHECK_PARSE("SpaceAfterLogicalNot: false", SpaceAfterLogicalNot,
+ false);
+
Style.ColumnLimit = 123;
FormatStyle BaseStyle = getLLVMStyle();
CHECK_PARSE("BasedOnStyle: LLVM", ColumnLimit, BaseStyle.ColumnLimit);
OpenPOWER on IntegriCloud