File tree Expand file tree Collapse file tree 6 files changed +40
-3
lines changed
Expand file tree Collapse file tree 6 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 1+ ## 16.0.1
2+
3+ * [ dart] Fixes test generation for missing wrapResponse method if only host Api.
4+
15## 16.0.0
26
37* [ java] Adds ` VoidResult ` type for ` Void ` returns.
Original file line number Diff line number Diff line change @@ -704,7 +704,7 @@ if (${_varNamePrefix}replyList == null) {
704704 if (hasHostApi) {
705705 _writeCreateConnectionError (indent);
706706 }
707- if (hasFlutterApi) {
707+ if (hasFlutterApi || generatorOptions.testOutPath != null ) {
708708 _writeWrapResponse (generatorOptions, root, indent);
709709 }
710710 }
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import 'ast.dart';
1313/// The current version of pigeon.
1414///
1515/// This must match the version in pubspec.yaml.
16- const String pigeonVersion = '16.0.0 ' ;
16+ const String pigeonVersion = '16.0.1 ' ;
1717
1818/// Read all the content from [stdin] to a String.
1919String readStdin () {
Original file line number Diff line number Diff line change @@ -474,6 +474,7 @@ class DartGeneratorAdapter implements GeneratorAdapter {
474474 final DartOptions dartOptionsWithHeader = _dartOptionsWithCopyrightHeader (
475475 options.dartOptions,
476476 options.copyrightHeader,
477+ testOutPath: options.dartTestOut,
477478 basePath: options.basePath ?? '' ,
478479 );
479480 const DartGenerator generator = DartGenerator ();
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: pigeon
22description : Code generator tool to make communication between Flutter and the host platform type-safe and easier.
33repository : https://github.com/flutter/packages/tree/main/packages/pigeon
44issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
5- version : 16.0.0 # This must match the version in lib/generator_tools.dart
5+ version : 16.0.1 # This must match the version in lib/generator_tools.dart
66
77environment :
88 sdk : " >=3.0.0 <4.0.0"
Original file line number Diff line number Diff line change @@ -1746,4 +1746,36 @@ name: foobar
17461746 contains (
17471747 '\' Unable to establish connection on channel: "\$ channelName".\' ' ));
17481748 });
1749+
1750+ test ('generate wrapResponse if is generating tests' , () {
1751+ final Root root = Root (
1752+ apis: < Api > [
1753+ Api (
1754+ name: 'Api' ,
1755+ location: ApiLocation .host,
1756+ dartHostTestHandler: 'ApiMock' ,
1757+ methods: < Method > [
1758+ Method (
1759+ name: 'foo' ,
1760+ returnType: const TypeDeclaration .voidDeclaration (),
1761+ parameters: < Parameter > [])
1762+ ])
1763+ ],
1764+ classes: < Class > [],
1765+ enums: < Enum > [],
1766+ );
1767+
1768+ final StringBuffer mainCodeSink = StringBuffer ();
1769+ const DartGenerator generator = DartGenerator ();
1770+ generator.generate (
1771+ const DartOptions (
1772+ testOutPath: 'test.dart' ,
1773+ ),
1774+ root,
1775+ mainCodeSink,
1776+ dartPackageName: DEFAULT_PACKAGE_NAME ,
1777+ );
1778+ final String mainCode = mainCodeSink.toString ();
1779+ expect (mainCode, contains ('List<Object?> wrapResponse(' ));
1780+ });
17491781}
You can’t perform that action at this time.
0 commit comments