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

Side by Side Diff: pkg/smoke/test/codegen/generator_test.dart

Issue 208743006: Fix smoke codegen for []. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « pkg/smoke/lib/codegen/generator.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library smoke.test.codegen.generator_test; 5 library smoke.test.codegen.generator_test;
6 6
7 import 'package:smoke/codegen/generator.dart'; 7 import 'package:smoke/codegen/generator.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import 'common.dart' show checkResults; 10 import 'common.dart' show checkResults;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 }); 105 });
106 106
107 test('declarations', () { 107 test('declarations', () {
108 var generator = new SmokeCodeGenerator(); 108 var generator = new SmokeCodeGenerator();
109 generator.addDeclaration(new TypeIdentifier('a.dart', 'A'), 'foo', 109 generator.addDeclaration(new TypeIdentifier('a.dart', 'A'), 'foo',
110 new TypeIdentifier('dart:core', 'int'), isField: true, isFinal: true); 110 new TypeIdentifier('dart:core', 'int'), isField: true, isFinal: true);
111 generator.addDeclaration(new TypeIdentifier('a.dart', 'A'), 'bar', 111 generator.addDeclaration(new TypeIdentifier('a.dart', 'A'), 'bar',
112 new TypeIdentifier('dart:core', 'Function'), isMethod: true, 112 new TypeIdentifier('dart:core', 'Function'), isMethod: true,
113 annotations: [new ConstExpression.constructor(null, 'Annotation', 113 annotations: [new ConstExpression.constructor(null, 'Annotation',
114 [new ConstExpression.string("hi")], const {})]); 114 [new ConstExpression.string("hi")], const {})]);
115 generator.addDeclaration(new TypeIdentifier('a.dart', 'A'), '[]',
116 new TypeIdentifier('dart:core', 'Function'), isMethod: true);
117 var symbol = "const Symbol('[]')";
118 var details = "$symbol, Function, kind: METHOD";
115 checkResults(generator, 119 checkResults(generator,
116 imports: ["import 'a.dart' as smoke_0;"], 120 imports: ["import 'a.dart' as smoke_0;"],
117 initCall: 121 initCall:
118 'useGeneratedCode(new StaticConfiguration(\n' 122 'useGeneratedCode(new StaticConfiguration(\n'
119 ' checkedMode: false,\n' 123 ' checkedMode: false,\n'
120 ' declarations: {\n' 124 ' declarations: {\n'
121 ' smoke_0.A: {\n' 125 ' smoke_0.A: {\n'
126 ' $symbol: const Declaration($details),\n'
122 ' #bar: const Declaration(#bar, Function, kind: METHOD, ' 127 ' #bar: const Declaration(#bar, Function, kind: METHOD, '
123 'annotations: const [const Annotation(\'hi\')]),\n' 128 'annotations: const [const Annotation(\'hi\')]),\n'
124 ' #foo: const Declaration(#foo, int, isFinal: true),\n' 129 ' #foo: const Declaration(#foo, int, isFinal: true),\n'
125 ' },\n' 130 ' },\n'
126 ' }));\n'); 131 ' }));\n');
127 }); 132 });
128 133
129 test('staticMethod', () { 134 test('staticMethod', () {
130 var generator = new SmokeCodeGenerator(); 135 var generator = new SmokeCodeGenerator();
131 generator.addStaticMethod(new TypeIdentifier('a.dart', 'A'), 'm1'); 136 generator.addStaticMethod(new TypeIdentifier('a.dart', 'A'), 'm1');
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 ' smoke_0.A: {\n' 192 ' smoke_0.A: {\n'
188 ' #foo: const Declaration(#foo, int, isFinal: true),\n' 193 ' #foo: const Declaration(#foo, int, isFinal: true),\n'
189 ' },\n' 194 ' },\n'
190 ' },\n' 195 ' },\n'
191 ' names: {\n' 196 ' names: {\n'
192 ' #c: r\'c\',\n' 197 ' #c: r\'c\',\n'
193 ' #d: r\'d\',\n' 198 ' #d: r\'d\',\n'
194 ' }));\n'); 199 ' }));\n');
195 }); 200 });
196 } 201 }
OLDNEW
« no previous file with comments | « pkg/smoke/lib/codegen/generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698