peterstys added inline comments.
================ Comment at: clang/unittests/Format/FormatTestCSharp.cpp:766 + + verifyFormat(R"(// +public class Sample { ---------------- peterstys wrote: > peterstys wrote: > > MyDeveloperDay wrote: > > > Nit: (only my preference) but I don't like the use of RawStrings in these > > > tests (I know others have let them creep in) but I find them more > > > unreadable because we lose the indentation.. I think I'm just so used to > > > the other style that this just crates a little. > > > > > > Just my personal preference (you can ignore) > > I used the RawStrings as it was very easy to copy snippet of code to a > > separate file so I could run clang-format on it to check all was working > > well. I also copied snippets to my local IDE to check if the file was > > building, or at least structurally okay (which I appreciate is not a > > requirements as clang-format does not build a complete AST of the code). > > > > For example, I was surprised to see some sample code in unit tests missing > > braces after catch (Exception) statement (line 694) (which may have been > > intended). I find it slightly more difficult to read those code snippets if > > they are decorated with \n. > > > > On the other hand, you're right, raw string break the indentation which is > > not great. Also, I'd rather follow the leading preferences (and wasn't sure > > which ones where they before your comment). I'm happy to update this to > > your style if that is the preference. > I tried to apply your preferred style but after running clang-format on the > test file, many files were split which made it look much less readable, in my > opinion. Here's an example: > > verifyFormat( > "public class Test\n" > "{\n" > " private static void ComplexLambda(BuildReport protoReport)\n" > " {\n" > " allSelectedScenes =\n" > " " > > "veryVeryLongCollectionNameThatPutsTheLineLenghtAboveTheThresholds.Where(" > "scene => scene.enabled)\n" > " .Select(scene => scene.path)\n" > " .ToArray();\n" > " if (allSelectedScenes.Count == 0)\n" > " {\n" > " return;\n" > " }\n" > " Functions();\n" > " AreWell();\n" > " Aligned();\n" > " AfterLambdaBlock();\n" > " }\n" > "}", > MicrosoftStyle); > > > I think it makes it look cleaner and more readable if we stick to the raw > string literals for my tests. WDYT? by "many files" I meant "many code snippets". CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115738/new/ https://reviews.llvm.org/D115738 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits