Chromium Code Reviews| Index: tests/compiler/dart2js/dump_info_test.dart |
| diff --git a/tests/compiler/dart2js/dump_info_test.dart b/tests/compiler/dart2js/dump_info_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..27e7337052103871d18395857298bd0d316e6138 |
| --- /dev/null |
| +++ b/tests/compiler/dart2js/dump_info_test.dart |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2012, 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. |
| +// Test that parameters keep their names in the output. |
| + |
| +import 'dart:async'; |
| +import "package:expect/expect.dart"; |
| +import "package:async_helper/async_helper.dart"; |
| +import 'memory_compiler.dart'; |
| + |
| +const String TEST_ONE = r""" |
| +library main; |
| + |
| +int a = 2; |
| + |
| +class c { |
| + final int m; |
| + c(this.m); |
| +} |
| + |
| +void f() { |
| + () {} (); // TODO (sigurdm) empty closure, hack to avoid inlining |
|
kasperl
2013/11/29 12:03:13
See if you can use @NoInline() annotation and get
sigurdm
2013/12/02 14:09:50
This seems to be a bit harder - the annotation is
|
| + a = 2; |
| +} |
| + |
| +main() { |
| + f(); |
| + new c(2); |
| +} |
| +"""; |
| + |
| +main() { |
| + var compiler = compilerFor({'main.dart': TEST_ONE}); |
| + asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { |
| + var info = compiler.dumpInfoTask.collectDumpInfo(); |
| + var mainlib = info.libraries[0]; |
| + Expect.stringEquals(mainlib.name, "main"); |
|
kasperl
2013/11/29 12:03:13
Expect.stringEquals expects the expected result as
sigurdm
2013/12/02 14:09:50
Done.
|
| + var contents = mainlib.contents; |
| + Expect.stringEquals(mainlib.name, "main"); |
| + Expect.stringEquals(contents[0].name, "a"); |
| + Expect.stringEquals(contents[1].name, "c"); |
| + Expect.stringEquals(contents[2].name, "f"); |
| + Expect.stringEquals(contents[3].name, "main"); |
| + Expect.stringEquals(mainlib.kind, "library"); |
| + Expect.stringEquals(contents[0].kind, "field"); |
| + Expect.stringEquals(contents[1].kind, "class"); |
| + Expect.stringEquals(contents[2].kind, "function"); |
| + Expect.stringEquals(contents[3].kind, "function"); |
| + })); |
| +} |