aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestCSharp.cpp
diff options
context:
space:
mode:
authorJonathan Coe <jbcoe@google.com>2020-04-16 14:20:51 +0100
committerJonathan Coe <jbcoe@google.com>2020-04-16 14:22:34 +0100
commit07c1978b15b4e9daefbf358e6fd185b5aa269f98 (patch)
treea44e37b82a31609743a12eabd35ab63d7ee0b47e /clang/unittests/Format/FormatTestCSharp.cpp
parent11f093fab4a38a652563cde52fcfa65ebcdc65e4 (diff)
downloadllvm-07c1978b15b4e9daefbf358e6fd185b5aa269f98.zip
llvm-07c1978b15b4e9daefbf358e6fd185b5aa269f98.tar.gz
llvm-07c1978b15b4e9daefbf358e6fd185b5aa269f98.tar.bz2
[clang-format] Do not interpret C# deconstruction in a foreach as a cast
Reviewers: krasimir Reviewed By: krasimir Subscribers: cfe-commits, MyDeveloperDay Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D78295
Diffstat (limited to 'clang/unittests/Format/FormatTestCSharp.cpp')
-rw-r--r--clang/unittests/Format/FormatTestCSharp.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestCSharp.cpp b/clang/unittests/Format/FormatTestCSharp.cpp
index b0e4e76..67571d3 100644
--- a/clang/unittests/Format/FormatTestCSharp.cpp
+++ b/clang/unittests/Format/FormatTestCSharp.cpp
@@ -624,6 +624,7 @@ TEST_F(FormatTestCSharp, CSharpSpaces) {
Style.SpaceBeforeCpp11BracedList = true;
Style.Cpp11BracedListStyle = false;
Style.SpacesInContainerLiterals = false;
+ Style.SpaceAfterCStyleCast = false;
verifyFormat(R"(new Car { "Door", 0.1 })", Style);
verifyFormat(R"(new Car { 0.1, "Door" })", Style);
@@ -642,6 +643,12 @@ TEST_F(FormatTestCSharp, CSharpSpaces) {
verifyFormat(R"(char[,,] rawCharArray = MakeCharacterGrid();)", Style);
+ // Not seen as a C-style cast.
+ verifyFormat(R"(//
+foreach ((A a, B b) in someList) {
+})",
+ Style);
+
Style.SpacesInSquareBrackets = true;
verifyFormat(R"(private float[ , ] Values;)", Style);
verifyFormat(R"(string dirPath = args?[ 0 ];)", Style);