OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 import 'package:compiler/src/compiler.dart' show Compiler; | |
6 import 'package:test/test.dart'; | |
7 | |
8 import 'helper.dart' show check; | |
9 | |
10 main() { | |
11 test('simple default constructor', () { | |
12 String code = ''' | |
13 class A { | |
14 } | |
15 | |
16 main() { | |
17 var a = new A(); | |
18 return a; | |
19 }'''; | |
20 return check(code, checkElement: (Compiler compiler) { | |
Siggi Cherem (dart-lang)
2016/11/14 18:22:25
nit: consider defining a helper function for this
Harry Terkelsen
2016/11/14 23:23:40
Done.
| |
21 ClassElement a = compiler.mainApp.find('A'); | |
22 return a.lookupDefaultConstructor(); | |
23 }); | |
24 }); | |
25 | |
26 test('simple default constructor with field', () { | |
27 String code = ''' | |
28 class A { | |
29 int x = 1; | |
30 } | |
31 | |
32 main() { | |
33 var a = new A(); | |
34 return a; | |
35 }'''; | |
36 return check(code, checkElement: (Compiler compiler) { | |
37 ClassElement a = compiler.mainApp.find('A'); | |
38 return a.lookupDefaultConstructor(); | |
39 }); | |
40 }); | |
41 } | |
OLD | NEW |