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

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

Issue 10583016: Add a test for operator[] unparse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Ready for review version Created 8 years, 6 months 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/unparser_test.dart
diff --git a/tests/compiler/dart2js/unparser_test.dart b/tests/compiler/dart2js/unparser_test.dart
index fb770fb9b3e78a51df186022d6f055bd73054a5c..eb2d679d113da4769284110266843714fba8534a 100644
--- a/tests/compiler/dart2js/unparser_test.dart
+++ b/tests/compiler/dart2js/unparser_test.dart
@@ -2,7 +2,9 @@
// 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('mock_compiler.dart');
#import('parser_helper.dart');
+#import("../../../lib/compiler/implementation/elements/elements.dart");
#import("../../../lib/compiler/implementation/tree/tree.dart");
testUnparse(String statement) {
@@ -26,8 +28,20 @@ testEmptyList() {
testUnparse('var x= [];');
}
+testIndexedOperatorDecl() {
+ MockCompiler compiler = new MockCompiler();
ahe 2012/06/19 16:42:45 Could you use this instead: Node parseMember(Stri
Anton Muhin 2012/06/19 18:02:05 Neat, thanks, done (almost veni, vidi, vici :) On
+ var elements = parseUnit(
+ 'class A { operator[](int i) => null; }',
+ compiler, compiler.mainApp);
+ ClassElement cls = elements.head.ensureResolved(compiler);
+ FunctionElement func = cls.members.head;
+ Node node = func.parseNode(compiler);
+ Expect.equals('operator[](int i)=> null;', '${node}');
+}
+
main() {
testGenericTypes();
testForLoop();
testEmptyList();
+ testIndexedOperatorDecl();
}

Powered by Google App Engine
This is Rietveld 408576698