OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:typed_data'; | 5 import 'dart:typed_data'; |
6 | 6 |
7 import 'package:front_end/src/base/flat_buffers.dart' as fb; | 7 import 'package:front_end/src/base/flat_buffers.dart' as fb; |
8 import 'package:front_end/src/incremental/format.dart'; | 8 import 'package:front_end/src/incremental/format.dart'; |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 2, | 79 2, |
80 3, | 80 3, |
81 4 | 81 4 |
82 ], imports: [ | 82 ], imports: [ |
83 new UnlinkedNamespaceDirectiveBuilder(uri: 'a.dart') | 83 new UnlinkedNamespaceDirectiveBuilder(uri: 'a.dart') |
84 ], exports: [ | 84 ], exports: [ |
85 new UnlinkedNamespaceDirectiveBuilder(uri: 'b.dart') | 85 new UnlinkedNamespaceDirectiveBuilder(uri: 'b.dart') |
86 ], parts: [ | 86 ], parts: [ |
87 new UnlinkedNamespaceDirectiveBuilder(uri: 'p1.dart'), | 87 new UnlinkedNamespaceDirectiveBuilder(uri: 'p1.dart'), |
88 new UnlinkedNamespaceDirectiveBuilder(uri: 'p2.dart'), | 88 new UnlinkedNamespaceDirectiveBuilder(uri: 'p2.dart'), |
89 ]).finish(fbBuilder); | 89 ], hasMixinApplication: true) |
| 90 .finish(fbBuilder); |
90 bytes = fbBuilder.finish(offset); | 91 bytes = fbBuilder.finish(offset); |
91 } | 92 } |
92 | 93 |
93 var directive = new UnlinkedUnit(bytes); | 94 var unit = new UnlinkedUnit(bytes); |
94 expect(directive.apiSignature, [0, 1, 2, 3, 4]); | 95 expect(unit.apiSignature, [0, 1, 2, 3, 4]); |
95 | 96 |
96 expect(directive.imports, hasLength(1)); | 97 expect(unit.imports, hasLength(1)); |
97 expect(directive.imports[0].uri, 'a.dart'); | 98 expect(unit.imports[0].uri, 'a.dart'); |
98 | 99 |
99 expect(directive.exports, hasLength(1)); | 100 expect(unit.exports, hasLength(1)); |
100 expect(directive.exports[0].uri, 'b.dart'); | 101 expect(unit.exports[0].uri, 'b.dart'); |
101 | 102 |
102 expect(directive.parts, hasLength(2)); | 103 expect(unit.parts, hasLength(2)); |
103 expect(directive.parts[0].uri, 'p1.dart'); | 104 expect(unit.parts[0].uri, 'p1.dart'); |
104 expect(directive.parts[1].uri, 'p2.dart'); | 105 expect(unit.parts[1].uri, 'p2.dart'); |
| 106 |
| 107 expect(unit.hasMixinApplication, isTrue); |
| 108 } |
| 109 |
| 110 void test_UnlinkedUnit_hasMixinApplication_false() { |
| 111 Uint8List bytes; |
| 112 { |
| 113 fb.Builder fbBuilder = new fb.Builder(); |
| 114 fb.Offset offset = |
| 115 new UnlinkedUnitBuilder(hasMixinApplication: false).finish(fbBuilder); |
| 116 bytes = fbBuilder.finish(offset); |
| 117 } |
| 118 |
| 119 var unit = new UnlinkedUnit(bytes); |
| 120 expect(unit.hasMixinApplication, isFalse); |
105 } | 121 } |
106 } | 122 } |
OLD | NEW |