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

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

Issue 10689104: Fix const unparse. Example: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add tests Created 8 years, 5 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') | no next file » | 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 testUnparseMember('foo()native "bar";'); 87 testUnparseMember('foo()native "bar";');
88 testUnparseMember('foo()native "this.x = 41";'); 88 testUnparseMember('foo()native "this.x = 41";');
89 } 89 }
90 90
91 testPrefixIncrements() { 91 testPrefixIncrements() {
92 testUnparse('++i;'); 92 testUnparse('++i;');
93 testUnparse('++a[i];'); 93 testUnparse('++a[i];');
94 testUnparse('++a[++b[i]];'); 94 testUnparse('++a[++b[i]];');
95 } 95 }
96 96
97 testConstParameterModifier() {
Anton Muhin 2012/07/06 10:22:46 please, add tests for: foo([var a = const {}]) {}
Roman 2012/07/06 11:46:05 Done. And I reverted the case for NewExpression.
98 testUnparse('foo([var a=const []]){}');
99 }
100
97 testSimpleFileUnparse() { 101 testSimpleFileUnparse() {
98 final src = ''' 102 final src = '''
99 should_be_dropped() { 103 should_be_dropped() {
100 } 104 }
101 105
102 should_be_kept() { 106 should_be_kept() {
103 } 107 }
104 108
105 main() { 109 main() {
106 should_be_kept(); 110 should_be_kept();
107 } 111 }
108 '''; 112 ''';
109 testDart2Dart(src, (String s) { 113 testDart2Dart(src, (String s) {
110 Expect.equals('should_be_kept(){}main(){should_be_kept();}', s); 114 Expect.equals('should_be_kept(){}main(){should_be_kept();}', s);
111 }); 115 });
112 } 116 }
113 117
114 main() { 118 main() {
115 testGenericTypes(); 119 testGenericTypes();
116 testForLoop(); 120 testForLoop();
117 testEmptyList(); 121 testEmptyList();
118 testClosure(); 122 testClosure();
119 testIndexedOperatorDecl(); 123 testIndexedOperatorDecl();
120 testNativeMethods(); 124 testNativeMethods();
121 testPrefixIncrements(); 125 testPrefixIncrements();
126 testConstParameterModifier();
122 testSimpleFileUnparse(); 127 testSimpleFileUnparse();
123 } 128 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/tree/unparser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698