But my idea is to reformat the file after these changes.
I expected only an empty string between string a = 1; string b = 2;, but I actually got an empty string with two whitespaces.
@Test
public void should_format_file_without_empty_line_with_whitespaces() {
// given
var loader = new SchemaLoader(FileSystems.getDefault());
var linker = new Linker(loader, new ErrorCollector(), true, true);
var testFileLocation = Location.get("<TEST_PROTO_FILE>");
loader.initRoots(List.of(testFileLocation), List.of(testFileLocation));
var file = loader.load("test/file.proto");
var schema = linker.link(List.of(file));
// when
var protoFile = schema.protoFile("test/file.proto");
// then
assertThat(protoFile.toSchema())
.isEqualTo("""
// Proto schema formatted by Wire, do not edit.
// Source: test/file.proto
syntax = "proto3";
package test.dependency;
message TestMessage {
message NestedMessage {
string a = 1;
string b = 2;
}
}
""");
}
I'm not sure if this can be considered a bug.
But my idea is to reformat the file after these changes.
I expected only an empty string between
string a = 1; string b = 2;
, but I actually got an empty string with two whitespaces.