Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: tests/compiler/dart2js/dump_info_test.dart

Issue 90713003: Dart2js option to dump info about compilation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
+}

Powered by Google App Engine
This is Rietveld 408576698