Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
574ee0b
crash fix
tarrinneal Mar 24, 2023
46ca75e
remove need for function
tarrinneal Mar 25, 2023
e350040
cleaner method method
tarrinneal Mar 29, 2023
3d31aff
better name
tarrinneal Mar 29, 2023
3be7eb1
fix enums and tests
tarrinneal Mar 30, 2023
ef111ee
enum fixes, and Any casting
tarrinneal Mar 30, 2023
6d5271f
gen test
tarrinneal Mar 30, 2023
a4625f8
Merge branch 'main' of github.com:flutter/packages into swift-nil
tarrinneal Mar 30, 2023
29ac0ec
simplify casting enum
tarrinneal Mar 30, 2023
4a7b408
Figured it out
tarrinneal Mar 30, 2023
d1d9c6f
Better name
tarrinneal Mar 31, 2023
241f0e3
gen tests
tarrinneal Mar 31, 2023
8d356cc
some nits
tarrinneal Mar 31, 2023
04dfdbd
writedecodecasting init
tarrinneal Mar 31, 2023
ed57271
This works, but does it explode on incorect type?
tarrinneal Apr 1, 2023
1bd3afa
cleaner with as Any
tarrinneal Apr 1, 2023
d0f9b86
gen test
tarrinneal Apr 1, 2023
fab7ca3
Merge branch 'main' of github.com:flutter/packages into swift-nil
tarrinneal Apr 1, 2023
2e2d337
comment
tarrinneal Apr 3, 2023
5b39dbe
fix NSNull issue in EchoBinaryMessenger
tarrinneal Apr 3, 2023
cbb8e0b
makes things better
tarrinneal Apr 4, 2023
7fa0f7d
gen tests
tarrinneal Apr 4, 2023
b0c7653
Improve _writeDecodeCasting
tarrinneal Apr 4, 2023
740abd8
Merge branch 'main' of github.com:flutter/packages into swift-nil
tarrinneal Apr 4, 2023
748a0bb
assert message
tarrinneal Apr 4, 2023
d8f5fe3
nits
tarrinneal Apr 4, 2023
06ab71e
comment
tarrinneal Apr 4, 2023
547ed02
nested ternary
tarrinneal Apr 4, 2023
367009e
gen test
tarrinneal Apr 4, 2023
cdf35ff
nits
tarrinneal Apr 4, 2023
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
gen tests
  • Loading branch information
tarrinneal committed Mar 31, 2023
commit 241f0e31e32917f5501dab11f81ab0fbf064687f
14 changes: 7 additions & 7 deletions packages/pigeon/test/swift_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void main() {
generator.generate(swiftOptions, root, sink);
final String code = sink.toString();
expect(code, contains('enum Foo: Int'));
expect(code, contains('let fooArg = Foo(rawValue: args[0] as! Int)!'));
expect(code, contains('let fooArg: Foo = Foo(rawValue: args[0] as! Int)!'));
});

test('gen one host api', () {
Expand Down Expand Up @@ -452,7 +452,7 @@ void main() {
expect(code, contains('struct Nested'));
expect(code, contains('var nested: Nested? = nil'));
expect(code, contains('static func fromList(_ list: [Any]) -> Outer?'));
expect(code, contains('nested = Nested.fromList(nestedList as [Any])'));
expect(code, contains('nested = Nested.fromList(nestedList)'));
expect(code, contains('func toList() -> [Any?]'));
});

Expand Down Expand Up @@ -767,7 +767,7 @@ void main() {
final String code = sink.toString();
expect(
code, contains('func doit(completion: @escaping ([Int64?]) -> Void'));
expect(code, contains('let result = response as! [Int64?]'));
expect(code, contains('let result: [Int64?] = response as! [Int64?]'));
expect(code, contains('completion(result)'));
});

Expand Down Expand Up @@ -797,8 +797,8 @@ void main() {
final String code = sink.toString();
expect(code, contains('func add(x: Int64, y: Int64) throws -> Int64'));
expect(code, contains('let args = message as! [Any]'));
expect(code, contains('let xArg = args[0] as! Int64'));
expect(code, contains('let yArg = args[1] as! Int64'));
expect(code, contains('let xArg: Int64 = args[0] as! Int64'));
expect(code, contains('let yArg: Int64 = args[1] as! Int64'));
expect(code, contains('let result = try api.add(x: xArg, y: yArg)'));
expect(code, contains('reply(wrapResult(result))'));
});
Expand Down Expand Up @@ -828,7 +828,7 @@ void main() {
generator.generate(swiftOptions, root, sink);
final String code = sink.toString();
expect(code, contains('let channel = FlutterBasicMessageChannel'));
expect(code, contains('let result = response as! Int64'));
expect(code, contains('let result: Int64 = response as! Int64'));
expect(code, contains('completion(result)'));
expect(
code,
Expand Down Expand Up @@ -915,7 +915,7 @@ void main() {
const SwiftGenerator generator = SwiftGenerator();
generator.generate(swiftOptions, root, sink);
final String code = sink.toString();
expect(code, contains('(nilOrValue(value: args[0]) as Any) as! Int64?'));
expect(code, contains('let fooArg: Int64? = nilOrValue(value: args[0])'));
});

test('nullable argument flutter', () {
Expand Down