Chromium Code Reviews| Index: tests/compiler/dart2js/kernel/constructors_test.dart |
| diff --git a/tests/compiler/dart2js/kernel/constructors_test.dart b/tests/compiler/dart2js/kernel/constructors_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..03441081e02b4ffdea3656944ca842225a54528b |
| --- /dev/null |
| +++ b/tests/compiler/dart2js/kernel/constructors_test.dart |
| @@ -0,0 +1,41 @@ |
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +import 'package:compiler/src/compiler.dart' show Compiler; |
| +import 'package:test/test.dart'; |
| + |
| +import 'helper.dart' show check; |
| + |
| +main() { |
| + test('simple default constructor', () { |
| + String code = ''' |
| +class A { |
| +} |
| + |
| +main() { |
| + var a = new A(); |
| + return a; |
| +}'''; |
| + 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.
|
| + ClassElement a = compiler.mainApp.find('A'); |
| + return a.lookupDefaultConstructor(); |
| + }); |
| + }); |
| + |
| + test('simple default constructor with field', () { |
| + String code = ''' |
| +class A { |
| + int x = 1; |
| +} |
| + |
| +main() { |
| + var a = new A(); |
| + return a; |
| +}'''; |
| + return check(code, checkElement: (Compiler compiler) { |
| + ClassElement a = compiler.mainApp.find('A'); |
| + return a.lookupDefaultConstructor(); |
| + }); |
| + }); |
| +} |