OLD | NEW |
1 library service_test; | 1 library service_test; |
2 | 2 |
3 import 'dart:async' show Future; | 3 import 'dart:async' show Future; |
4 | 4 |
5 import 'package:protobuf/protobuf.dart'; | 5 import 'package:protobuf/protobuf.dart'; |
6 import 'package:test/test.dart'; | 6 import 'package:test/test.dart'; |
7 | 7 |
8 import '../out/protos/service.pb.dart' as pb; | 8 import '../out/protos/service.pb.dart' as pb; |
9 import '../out/protos/service2.pb.dart' as pb2; | 9 import '../out/protos/service2.pb.dart' as pb2; |
10 import '../out/protos/service3.pb.dart' as pb3; | 10 import '../out/protos/service3.pb.dart' as pb3; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 var map = service.$messageJson; | 102 var map = service.$messageJson; |
103 expect(map.keys, [ | 103 expect(map.keys, [ |
104 '.SearchRequest', | 104 '.SearchRequest', |
105 '.SearchResponse', | 105 '.SearchResponse', |
106 '.service2.SearchRequest', | 106 '.service2.SearchRequest', |
107 '.service2.SearchResponse', | 107 '.service2.SearchResponse', |
108 '.service3.SearchResult', | 108 '.service3.SearchResult', |
109 ]); | 109 ]); |
110 | 110 |
111 String readMessageName(fqname) { | 111 String readMessageName(fqname) { |
112 var descriptor = new DescriptorProto() | 112 var json = map[fqname] as Map<String, dynamic>; |
113 ..mergeFromJsonMap(map[fqname]); | 113 var descriptor = new DescriptorProto()..mergeFromJsonMap(json); |
114 return descriptor.name; | 114 return descriptor.name; |
115 } | 115 } |
116 expect(readMessageName('.SearchRequest'), "SearchRequest"); | 116 expect(readMessageName('.SearchRequest'), "SearchRequest"); |
117 expect(readMessageName('.service2.SearchRequest'), "SearchRequest"); | 117 expect(readMessageName('.service2.SearchRequest'), "SearchRequest"); |
118 expect(readMessageName('.service3.SearchResult'), "SearchResult"); | 118 expect(readMessageName('.service3.SearchResult'), "SearchResult"); |
119 }); | 119 }); |
120 } | 120 } |
OLD | NEW |