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

Side by Side Diff: tests/compiler/dart2js/unparser_test.dart

Issue 10824113: Fix interpolation unparse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/tree/unparser.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import('dart:uri'); 5 #import('dart:uri');
6 #import('parser_helper.dart'); 6 #import('parser_helper.dart');
7 #import("../../../lib/compiler/compiler.dart"); 7 #import("../../../lib/compiler/compiler.dart");
8 #import("../../../lib/compiler/implementation/tree/tree.dart"); 8 #import("../../../lib/compiler/implementation/tree/tree.dart");
9 9
10 testUnparse(String statement) { 10 testUnparse(String statement) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 testEmptyList() { 106 testEmptyList() {
107 testUnparse('var x= [];'); 107 testUnparse('var x= [];');
108 } 108 }
109 109
110 testClosure() { 110 testClosure() {
111 testUnparse('var x=(var x)=> x;'); 111 testUnparse('var x=(var x)=> x;');
112 } 112 }
113 113
114 testIndexedOperatorDecl() { 114 testIndexedOperatorDecl() {
115 testUnparseMember('operator[](int i)=> null;'); 115 testUnparseMember('operator[](int i)=> null;');
116 testUnparseMember('operator[]=(int i, int j)=> null;'); 116 testUnparseMember('operator[]=(int i,int j)=> null;');
117 } 117 }
118 118
119 testNativeMethods() { 119 testNativeMethods() {
120 testUnparseMember('foo()native;'); 120 testUnparseMember('foo()native;');
121 testUnparseMember('foo()native "bar";'); 121 testUnparseMember('foo()native "bar";');
122 testUnparseMember('foo()native "this.x = 41";'); 122 testUnparseMember('foo()native "this.x = 41";');
123 } 123 }
124 124
125 testPrefixIncrements() { 125 testPrefixIncrements() {
126 testUnparse('++i;'); 126 testUnparse('++i;');
127 testUnparse('++a[i];'); 127 testUnparse('++a[i];');
128 testUnparse('++a[++b[i]];'); 128 testUnparse('++a[++b[i]];');
129 } 129 }
130 130
131 testConstModifier() { 131 testConstModifier() {
132 testUnparse('foo([var a=const []]){}'); 132 testUnparse('foo([var a=const []]){}');
133 testUnparse('foo([var a=const{}]){}'); 133 testUnparse('foo([var a=const{}]){}');
134 testUnparse('foo(){var a=const []; var b=const{};}'); 134 testUnparse('foo(){var a=const []; var b=const{};}');
135 testUnparse('foo([var a=const [const{"a": const [1, 2, 3]}]]){}'); 135 testUnparse('foo([var a=const [const{"a": const [1,2,3]}]]){}');
136 } 136 }
137 137
138 testSimpleFileUnparse() { 138 testSimpleFileUnparse() {
139 final src = ''' 139 final src = '''
140 should_be_dropped() { 140 should_be_dropped() {
141 } 141 }
142 142
143 should_be_kept() { 143 should_be_kept() {
144 } 144 }
145 145
(...skipping 25 matching lines...) Expand all
171 testClassWithMethod() { 171 testClassWithMethod() {
172 testDart2Dart('main(){var a=new A(); a.foo();}class A{void foo(){}}'); 172 testDart2Dart('main(){var a=new A(); a.foo();}class A{void foo(){}}');
173 } 173 }
174 174
175 testExtendsImplements() { 175 testExtendsImplements() {
176 testDart2Dart('main(){new B<Object>();}' 176 testDart2Dart('main(){new B<Object>();}'
177 'class A<T>{}class B<T> extends A<T>{}'); 177 'class A<T>{}class B<T> extends A<T>{}');
178 } 178 }
179 179
180 testVariableDefinitions() { 180 testVariableDefinitions() {
181 testDart2Dart('main(){final var x, y; final String s;}'); 181 testDart2Dart('main(){final var x,y; final String s;}');
182 testDart2Dart('foo(f, g){}main(){foo(1, 2);}'); 182 testDart2Dart('foo(f,g){}main(){foo(1,2);}');
183 testDart2Dart('foo(f(arg)){}main(){foo(main);}'); 183 testDart2Dart('foo(f(arg)){}main(){foo(main);}');
184 // A couple of static/finals inside a class. 184 // A couple of static/finals inside a class.
185 testDart2Dart('main(){A.a; A.b;}class A{static final String a="5";' 185 testDart2Dart('main(){A.a; A.b;}class A{static final String a="5";'
186 'static final String b="4";}'); 186 'static final String b="4";}');
187 // Class member of typedef-ed function type. 187 // Class member of typedef-ed function type.
188 // Maybe typedef should be included in the result too, but it 188 // Maybe typedef should be included in the result too, but it
189 // works fine without it. 189 // works fine without it.
190 testDart2Dart('typedef void foofunc(arg);' 190 testDart2Dart('typedef void foofunc(arg);'
191 'class A {' 191 'class A {'
192 'final foofunc handler;' 192 'final foofunc handler;'
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 testGetSet(); 425 testGetSet();
426 testFactoryConstructor(); 426 testFactoryConstructor();
427 testTopLevelField(); 427 testTopLevelField();
428 testAbstractClass(); 428 testAbstractClass();
429 testConflictLibraryClassRename(); 429 testConflictLibraryClassRename();
430 testNoConflictSendsRename(); 430 testNoConflictSendsRename();
431 testConflictSendsRename(); 431 testConflictSendsRename();
432 testDefaultClassWithArgs(); 432 testDefaultClassWithArgs();
433 testClassExtendsWithArgs(); 433 testClassExtendsWithArgs();
434 } 434 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/tree/unparser.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698