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..70eab981a094bcee28293945b74e19d4bf43f6a3 |
| --- /dev/null |
| +++ b/tests/compiler/dart2js/dump_info_test.dart |
| @@ -0,0 +1,52 @@ |
| +// 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 |
| + a = 2; |
| +} |
| + |
| +main() { |
| + f(); |
| + new c(2); |
| +} |
| +"""; |
| + |
| +main() { |
| + MemoryCompiler compiler = compilerFor({'main.dart': TEST_ONE}); |
| + asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { |
| + Map info = compiler.backend.collectDumpInfo(); |
| + print(info); |
| + var mainlib = info["libraries"][0]; |
| + Expect.stringEquals(mainlib["name"], "main"); |
| + 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"); |
| + })); |
| +; |
|
ahe
2013/11/27 19:28:53
?
sigurdm
2013/11/29 10:39:37
Done.
|
| +} |