Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix trailing whitespace in prologue
  • Loading branch information
stuartmorgan-g committed Jan 18, 2024
commit 865d95c2c0d5a2967300bd0b754dfbe7dd7fec26
2 changes: 1 addition & 1 deletion packages/pigeon/lib/generator_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ bool isVoid(TypeMirror type) {
void addLines(Indent indent, Iterable<String> lines, {String? linePrefix}) {
final String prefix = linePrefix ?? '';
for (final String line in lines) {
indent.writeln('$prefix$line');
indent.writeln('$prefix$line'.trimRight());
}
}

Expand Down
6 changes: 4 additions & 2 deletions packages/pigeon/test/swift_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@ void main() {
test('header', () {
final Root root = Root(apis: <Api>[], classes: <Class>[], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
final SwiftOptions swiftOptions = SwiftOptions(
copyrightHeader: makeIterable('hello world'),
const SwiftOptions swiftOptions = SwiftOptions(
copyrightHeader: ['hello world', ''],
);
const SwiftGenerator generator = SwiftGenerator();
generator.generate(
Expand All @@ -726,6 +726,8 @@ void main() {
);
final String code = sink.toString();
expect(code, startsWith('// hello world'));
// There should be no trailing whitespace on generated comments.
expect(code, isNot(matches(RegExp(r'^//.* $', multiLine: true))));
});

test('generics - list', () {
Expand Down