OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library smoke.test.codegen.recorder_test; | 5 library smoke.test.codegen.recorder_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
8 import 'package:smoke/codegen/generator.dart'; | 8 import 'package:smoke/codegen/generator.dart'; |
9 import 'package:smoke/codegen/recorder.dart'; | 9 import 'package:smoke/codegen/recorder.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 ' smoke_0.D: _M0,\n' | 321 ' smoke_0.D: _M0,\n' |
322 ' _M0: smoke_0.C,\n' | 322 ' _M0: smoke_0.C,\n' |
323 ' },\n' | 323 ' },\n' |
324 ' declarations: {\n' | 324 ' declarations: {\n' |
325 ' smoke_0.D: const {},\n' | 325 ' smoke_0.D: const {},\n' |
326 ' _M0: {\n' | 326 ' _M0: {\n' |
327 ' #i: const Declaration(#i, int),\n' | 327 ' #i: const Declaration(#i, int),\n' |
328 ' },\n' | 328 ' },\n' |
329 ' }));\n'); | 329 ' }));\n'); |
330 }); | 330 }); |
| 331 |
| 332 test('inherited field - recursive deep', () { |
| 333 recorder.lookupMember(lib.getType('J3'), 'i', recursive: true, |
| 334 includeAccessors: false); |
| 335 checkResults(generator, |
| 336 imports: [ |
| 337 "import '/common.dart' as smoke_0;", |
| 338 ], |
| 339 initCall: |
| 340 'useGeneratedCode(new StaticConfiguration(\n' |
| 341 ' checkedMode: false,\n' |
| 342 ' parents: {\n' |
| 343 ' smoke_0.J2: smoke_0.J1,\n' |
| 344 ' smoke_0.J3: smoke_0.J2,\n' |
| 345 ' },\n' |
| 346 ' declarations: {\n' |
| 347 ' smoke_0.J1: {\n' |
| 348 ' #i: const Declaration(#i, int),\n' |
| 349 ' },\n' |
| 350 ' smoke_0.J2: const {},\n' |
| 351 ' smoke_0.J3: const {},\n' |
| 352 ' }));\n'); |
| 353 }); |
| 354 |
| 355 test('inherited field - recursive - includeUpTo', () { |
| 356 recorder.lookupMember(lib.getType('J3'), 'i', recursive: true, |
| 357 includeAccessors: false, includeUpTo: lib.getType('J1')); |
| 358 checkResults(generator, |
| 359 imports: [ |
| 360 "import '/common.dart' as smoke_0;", |
| 361 ], |
| 362 initCall: |
| 363 'useGeneratedCode(new StaticConfiguration(\n' |
| 364 ' checkedMode: false,\n' |
| 365 ' parents: {\n' |
| 366 ' smoke_0.J2: smoke_0.J1,\n' |
| 367 ' smoke_0.J3: smoke_0.J2,\n' |
| 368 ' },\n' |
| 369 ' declarations: {\n' |
| 370 ' smoke_0.J2: const {},\n' |
| 371 ' smoke_0.J3: const {},\n' |
| 372 ' }));\n'); |
| 373 }); |
331 }); | 374 }); |
332 | 375 |
333 group('query', () { | 376 group('query', () { |
334 test('default query', () { | 377 test('default query', () { |
335 var options = new QueryOptions(); | 378 var options = new QueryOptions(); |
336 var lib = provider.libraryFor('/common.dart'); | 379 var lib = provider.libraryFor('/common.dart'); |
337 recorder.runQuery(lib.getType('A'), options, includeAccessors: false); | 380 recorder.runQuery(lib.getType('A'), options, includeAccessors: false); |
338 checkResults(generator, | 381 checkResults(generator, |
339 imports: [ | 382 imports: [ |
340 "import '/common.dart' as smoke_0;", | 383 "import '/common.dart' as smoke_0;", |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 @Annot(1) int j; | 822 @Annot(1) int j; |
780 } | 823 } |
781 | 824 |
782 class I { | 825 class I { |
783 dynamic i1; | 826 dynamic i1; |
784 get i2 => null; | 827 get i2 => null; |
785 set i2(v) {} | 828 set i2(v) {} |
786 G get i3; | 829 G get i3; |
787 G m4() {}; | 830 G m4() {}; |
788 } | 831 } |
| 832 |
| 833 class J1 { |
| 834 int i; |
| 835 } |
| 836 class J2 extends J1 { |
| 837 } |
| 838 class J3 extends J2 { |
| 839 } |
789 ''' | 840 ''' |
790 }; | 841 }; |
791 | 842 |
792 resolveImportUrl(LibraryElement lib) => | 843 resolveImportUrl(LibraryElement lib) => |
793 lib.isDartCore ? 'dart:core' : '/${lib.displayName}.dart'; | 844 lib.isDartCore ? 'dart:core' : '/${lib.displayName}.dart'; |
OLD | NEW |