return 150;
if (Left.Type == TT_CastRParen)
return 100;
- if (Left.is(tok::coloncolon))
+ if (Left.is(tok::coloncolon) ||
+ (Right.is(tok::period) && Style.Language == FormatStyle::LK_Proto))
return 500;
if (Left.isOneOf(tok::kw_class, tok::kw_struct))
return 5000;
}
static std::string format(llvm::StringRef Code) {
- return format(Code, 0, Code.size(), getGoogleProtoStyle());
+ FormatStyle Style = getGoogleProtoStyle();
+ Style.ColumnLimit = 60; // To make writing tests easier.
+ return format(Code, 0, Code.size(), Style);
}
static void verifyFormat(llvm::StringRef Code) {
" required int32 field1 = 1;\n"
" optional string field2 = 2 [default = \"2\"]\n"
"}");
+
+ verifyFormat("message SomeMessage {\n"
+ " optional really.really.long.and.qualified.type.aaaaaaa\n"
+ " fiiiiiiiiiiiiiiiiiiiiiiiiield = 1;\n"
+ " optional\n"
+ " really.really.long.and.qualified.type.aaaaaaa.aaaaaaaa\n"
+ " another_fiiiiiiiiiiiiiiiiiiiiield = 2;\n"
+ "}");
}
TEST_F(FormatTestProto, FormatsEnums) {