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

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: Address Anton comments 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
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 testConstModifier() {
98 testUnparse('foo([var a=const []]){}');
99 testUnparse('foo([var a=const{}]){}');
100 testUnparse('foo(){var a=const []; var b=const{};}');
101 testUnparse('foo([var a=const [const{"a": const [1, 2, 3]}]]){}');
102 }
103
97 testSimpleFileUnparse() { 104 testSimpleFileUnparse() {
98 final src = ''' 105 final src = '''
99 should_be_dropped() { 106 should_be_dropped() {
100 } 107 }
101 108
102 should_be_kept() { 109 should_be_kept() {
103 } 110 }
104 111
105 main() { 112 main() {
106 should_be_kept(); 113 should_be_kept();
107 } 114 }
108 '''; 115 ''';
109 testDart2Dart(src, (String s) { 116 testDart2Dart(src, (String s) {
110 Expect.equals('should_be_kept(){}main(){should_be_kept();}', s); 117 Expect.equals('should_be_kept(){}main(){should_be_kept();}', s);
111 }); 118 });
112 } 119 }
113 120
114 main() { 121 main() {
115 testGenericTypes(); 122 testGenericTypes();
116 testForLoop(); 123 testForLoop();
117 testEmptyList(); 124 testEmptyList();
118 testClosure(); 125 testClosure();
119 testIndexedOperatorDecl(); 126 testIndexedOperatorDecl();
120 testNativeMethods(); 127 testNativeMethods();
121 testPrefixIncrements(); 128 testPrefixIncrements();
129 testConstModifier();
122 testSimpleFileUnparse(); 130 testSimpleFileUnparse();
123 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698