Visitar URL original
Pigeon : Support for asynchronous methods/Functions by xsahil03x · Pull Request #201 · flutter/packages · GitHub
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 tests
Signed-off-by: Sahil Kumar <xdsahil@gmail.com>
  • Loading branch information
xsahil03x committed Sep 24, 2020
commit e78437e52b071f1749e02d7bf0d06e3f90cbb352
60 changes: 50 additions & 10 deletions packages/pigeon/test/dart_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/dart_generator.dart';
import 'package:pigeon/generator_tools.dart';
import 'package:test/test.dart';
import 'package:pigeon/dart_generator.dart';
import 'package:pigeon/ast.dart';

void main() {
test('gen one class', () {
Expand All @@ -29,7 +29,12 @@ void main() {
test('gen one host api', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'Output')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'Output',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand Down Expand Up @@ -69,7 +74,12 @@ void main() {
test('flutterapi', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'Output')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'Output',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -89,7 +99,12 @@ void main() {
test('host void', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'void')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'void',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -106,7 +121,12 @@ void main() {
test('flutter void return', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'void')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'void',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -124,7 +144,12 @@ void main() {
test('flutter void argument', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
Method(name: 'doSomething', argType: 'void', returnType: 'Output')
Method(
name: 'doSomething',
argType: 'void',
returnType: 'Output',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -141,7 +166,12 @@ void main() {
test('host void argument', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(name: 'doSomething', argType: 'void', returnType: 'Output')
Method(
name: 'doSomething',
argType: 'void',
returnType: 'Output',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -161,8 +191,18 @@ void main() {
location: ApiLocation.host,
dartHostTestHandler: 'ApiMock',
methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'Output'),
Method(name: 'voidReturner', argType: 'Input', returnType: 'void')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'Output',
isAsynchronous: false,
),
Method(
name: 'voidReturner',
argType: 'Input',
returnType: 'void',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand Down
46 changes: 38 additions & 8 deletions packages/pigeon/test/java_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:test/test.dart';
import 'package:pigeon/java_generator.dart';
import 'package:pigeon/ast.dart';
import 'package:pigeon/java_generator.dart';
import 'package:test/test.dart';

void main() {
test('gen one class', () {
Expand Down Expand Up @@ -52,7 +52,12 @@ void main() {
test('gen one host api', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'Output')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'Output',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand Down Expand Up @@ -104,7 +109,12 @@ void main() {
test('gen one flutter api', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'Output')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'Output',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -126,7 +136,12 @@ void main() {
test('gen host void api', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'void')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'void',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -145,7 +160,12 @@ void main() {
test('gen flutter void return api', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
Method(name: 'doSomething', argType: 'Input', returnType: 'void')
Method(
name: 'doSomething',
argType: 'Input',
returnType: 'void',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -165,7 +185,12 @@ void main() {
test('gen host void argument api', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.host, methods: <Method>[
Method(name: 'doSomething', argType: 'void', returnType: 'Output')
Method(
name: 'doSomething',
argType: 'void',
returnType: 'Output',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand All @@ -184,7 +209,12 @@ void main() {
test('gen flutter void argument api', () {
final Root root = Root(apis: <Api>[
Api(name: 'Api', location: ApiLocation.flutter, methods: <Method>[
Method(name: 'doSomething', argType: 'void', returnType: 'Output')
Method(
name: 'doSomething',
argType: 'void',
returnType: 'Output',
isAsynchronous: false,
)
])
], classes: <Class>[
Class(
Expand Down