mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 07:08:10 +08:00
[pigeon] doc comments always start with ' ' (#2825)
* doc comments always start with ' ' * add unit tests * remove unused import * small test scaffolding fix to allow publish
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
## 4.2.6
|
||||
|
||||
* Fixes bug with parsing documentation comments that start with '/'.
|
||||
|
||||
## 4.2.5
|
||||
|
||||
* [dart] Fixes enum parameter handling in Dart test API class.
|
||||
|
@ -9,7 +9,7 @@ import 'dart:mirrors';
|
||||
import 'ast.dart';
|
||||
|
||||
/// The current version of pigeon. This must match the version in pubspec.yaml.
|
||||
const String pigeonVersion = '4.2.5';
|
||||
const String pigeonVersion = '4.2.6';
|
||||
|
||||
/// Read all the content from [stdin] to a String.
|
||||
String readStdin() {
|
||||
@ -474,7 +474,10 @@ void addDocumentationComments(
|
||||
indent.writeln(commentSpec.openCommentToken);
|
||||
currentLineOpenToken = commentSpec.blockContinuationToken;
|
||||
}
|
||||
for (final String line in allComments) {
|
||||
for (String line in allComments) {
|
||||
if (line.isNotEmpty && line[0] != ' ') {
|
||||
line = ' $line';
|
||||
}
|
||||
indent.writeln(
|
||||
'$currentLineOpenToken$line',
|
||||
);
|
||||
|
@ -20,6 +20,10 @@ import 'package:pigeon/pigeon.dart';
|
||||
/// This comment is to test enum documentation comments.
|
||||
///
|
||||
/// This comment also tests multiple line comments.
|
||||
///
|
||||
///////////////////////////
|
||||
/// This comment also tests comments that start with '/'
|
||||
///////////////////////////
|
||||
enum MessageRequestState {
|
||||
pending,
|
||||
success,
|
||||
|
@ -2,4 +2,4 @@
|
||||
# changes on generated files. This will need a way to avoid unnecessary churn,
|
||||
# such as a flag to suppress version stamp generation.
|
||||
*.java
|
||||
!AlternateLanguageTestPlugin.kt
|
||||
!AlternateLanguageTestPlugin.java
|
||||
|
@ -2,7 +2,7 @@ name: pigeon
|
||||
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon
|
||||
version: 4.2.5 # This must match the version in lib/generator_tools.dart
|
||||
version: 4.2.6 # This must match the version in lib/generator_tools.dart
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
@ -1062,6 +1062,9 @@ void main() {
|
||||
];
|
||||
int count = 0;
|
||||
|
||||
final List<String> unspacedComments = <String>['////////'];
|
||||
int unspacedCount = 0;
|
||||
|
||||
final Root root = Root(
|
||||
apis: <Api>[
|
||||
Api(
|
||||
@ -1107,7 +1110,10 @@ void main() {
|
||||
enums: <Enum>[
|
||||
Enum(
|
||||
name: 'enum',
|
||||
documentationComments: <String>[comments[count++]],
|
||||
documentationComments: <String>[
|
||||
comments[count++],
|
||||
unspacedComments[unspacedCount++]
|
||||
],
|
||||
members: <String>[
|
||||
'one',
|
||||
'two',
|
||||
@ -1121,6 +1127,7 @@ void main() {
|
||||
for (final String comment in comments) {
|
||||
expect(code, contains('//$comment'));
|
||||
}
|
||||
expect(code, contains('// ///'));
|
||||
});
|
||||
|
||||
test('doesnt create codecs if no custom datatypes', () {
|
||||
|
@ -1174,6 +1174,10 @@ name: foobar
|
||||
' enum comment',
|
||||
];
|
||||
int count = 0;
|
||||
|
||||
final List<String> unspacedComments = <String>['////////'];
|
||||
int unspacedCount = 0;
|
||||
|
||||
final Root root = Root(
|
||||
apis: <Api>[
|
||||
Api(
|
||||
@ -1219,7 +1223,10 @@ name: foobar
|
||||
enums: <Enum>[
|
||||
Enum(
|
||||
name: 'enum',
|
||||
documentationComments: <String>[comments[count++]],
|
||||
documentationComments: <String>[
|
||||
comments[count++],
|
||||
unspacedComments[unspacedCount++]
|
||||
],
|
||||
members: <String>[
|
||||
'one',
|
||||
'two',
|
||||
@ -1233,6 +1240,7 @@ name: foobar
|
||||
for (final String comment in comments) {
|
||||
expect(code, contains('///$comment'));
|
||||
}
|
||||
expect(code, contains('/// ///'));
|
||||
});
|
||||
|
||||
test('doesnt create codecs if no custom datatypes', () {
|
||||
|
@ -1139,6 +1139,9 @@ void main() {
|
||||
];
|
||||
int count = 0;
|
||||
|
||||
final List<String> unspacedComments = <String>['////////'];
|
||||
int unspacedCount = 0;
|
||||
|
||||
final Root root = Root(
|
||||
apis: <Api>[
|
||||
Api(
|
||||
@ -1185,7 +1188,10 @@ void main() {
|
||||
enums: <Enum>[
|
||||
Enum(
|
||||
name: 'enum',
|
||||
documentationComments: <String>[comments[count++]],
|
||||
documentationComments: <String>[
|
||||
comments[count++],
|
||||
unspacedComments[unspacedCount++]
|
||||
],
|
||||
members: <String>[
|
||||
'one',
|
||||
'two',
|
||||
@ -1204,6 +1210,7 @@ void main() {
|
||||
.hasMatch(code),
|
||||
true);
|
||||
}
|
||||
expect(code, isNot(contains('*//')));
|
||||
});
|
||||
|
||||
test('doesnt create codecs if no custom datatypes', () {
|
||||
|
@ -1019,6 +1019,9 @@ void main() {
|
||||
];
|
||||
int count = 0;
|
||||
|
||||
final List<String> unspacedComments = <String>['////////'];
|
||||
int unspacedCount = 0;
|
||||
|
||||
final Root root = Root(
|
||||
apis: <Api>[
|
||||
Api(
|
||||
@ -1065,7 +1068,10 @@ void main() {
|
||||
enums: <Enum>[
|
||||
Enum(
|
||||
name: 'enum',
|
||||
documentationComments: <String>[comments[count++]],
|
||||
documentationComments: <String>[
|
||||
comments[count++],
|
||||
unspacedComments[unspacedCount++]
|
||||
],
|
||||
members: <String>[
|
||||
'one',
|
||||
'two',
|
||||
@ -1084,6 +1090,7 @@ void main() {
|
||||
.hasMatch(code),
|
||||
true);
|
||||
}
|
||||
expect(code, isNot(contains('*//')));
|
||||
});
|
||||
|
||||
test('doesnt create codecs if no custom datatypes', () {
|
||||
|
@ -1751,6 +1751,9 @@ void main() {
|
||||
];
|
||||
int count = 0;
|
||||
|
||||
final List<String> unspacedComments = <String>['////////'];
|
||||
int unspacedCount = 0;
|
||||
|
||||
final Root root = Root(
|
||||
apis: <Api>[
|
||||
Api(
|
||||
@ -1797,7 +1800,10 @@ void main() {
|
||||
enums: <Enum>[
|
||||
Enum(
|
||||
name: 'enum',
|
||||
documentationComments: <String>[comments[count++]],
|
||||
documentationComments: <String>[
|
||||
comments[count++],
|
||||
unspacedComments[unspacedCount++]
|
||||
],
|
||||
members: <String>[
|
||||
'one',
|
||||
'two',
|
||||
@ -1811,6 +1817,7 @@ void main() {
|
||||
for (final String comment in comments) {
|
||||
expect(code, contains('///$comment'));
|
||||
}
|
||||
expect(code, contains('/// ///'));
|
||||
});
|
||||
|
||||
test('doesnt create codecs if no custom datatypes', () {
|
||||
|
@ -958,6 +958,9 @@ void main() {
|
||||
];
|
||||
int count = 0;
|
||||
|
||||
final List<String> unspacedComments = <String>['////////'];
|
||||
int unspacedCount = 0;
|
||||
|
||||
final Root root = Root(
|
||||
apis: <Api>[
|
||||
Api(
|
||||
@ -1004,7 +1007,10 @@ void main() {
|
||||
enums: <Enum>[
|
||||
Enum(
|
||||
name: 'enum',
|
||||
documentationComments: <String>[comments[count++]],
|
||||
documentationComments: <String>[
|
||||
comments[count++],
|
||||
unspacedComments[unspacedCount++]
|
||||
],
|
||||
members: <String>[
|
||||
'one',
|
||||
'two',
|
||||
@ -1019,6 +1025,7 @@ void main() {
|
||||
for (final String comment in comments) {
|
||||
expect(code, contains('///$comment'));
|
||||
}
|
||||
expect(code, contains('/// ///'));
|
||||
});
|
||||
|
||||
test('doesnt create codecs if no custom datatypes', () {
|
||||
|
Reference in New Issue
Block a user