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

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

Issue 303003003: Fix 19029: handle special case when on-handler is empty in polymer, add better (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/smoke/pubspec.yaml ('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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ' setters: {\n' 47 ' setters: {\n'
48 ' #foo: (o, v) { o.foo = v; },\n' 48 ' #foo: (o, v) { o.foo = v; },\n'
49 ' #i: (o, v) { o.i = v; },\n' 49 ' #i: (o, v) { o.i = v; },\n'
50 ' }));\n'); 50 ' }));\n');
51 }); 51 });
52 52
53 test('names/symbols', () { 53 test('names/symbols', () {
54 var generator = new SmokeCodeGenerator(); 54 var generator = new SmokeCodeGenerator();
55 generator.addSymbol('i'); 55 generator.addSymbol('i');
56 generator.addSymbol('foo'); 56 generator.addSymbol('foo');
57 generator.addSymbol('a.b.c');
58 generator.addSymbol('a.b.[]');
59 generator.addSymbol('[]');
60 generator.addSymbol('+');
57 checkResults(generator, initCall: 61 checkResults(generator, initCall:
58 'useGeneratedCode(new StaticConfiguration(\n' 62 'useGeneratedCode(new StaticConfiguration(\n'
59 ' checkedMode: false,\n' 63 ' checkedMode: false,\n'
60 ' names: {\n' 64 ' names: {\n'
65 ' const Symbol(\'+\'): r\'+\',\n'
66 ' const Symbol(\'[]\'): r\'[]\',\n'
67 ' const Symbol(\'a.b.[]\'): r\'a.b.[]\',\n'
68 ' #a.b.c: r\'a.b.c\',\n'
61 ' #foo: r\'foo\',\n' 69 ' #foo: r\'foo\',\n'
62 ' #i: r\'i\',\n' 70 ' #i: r\'i\',\n'
63 ' }));\n'); 71 ' }));\n');
64 }); 72 });
65 73
74 group('invalid symbols', () {
75 var invalidError =
76 predicate((e) => e is StateError && '$e'.contains("invalid symbol"));
77 test('traling period', () {
78 var generator = new SmokeCodeGenerator();
79 generator.addSymbol('a.');
80 var sb = new StringBuffer();
81 expect(() => generator.writeInitCall(sb), throwsA(invalidError));
82 });
83
84 test('operator in the middle', () {
85 var generator = new SmokeCodeGenerator();
86 generator.addSymbol('a.[].b');
87 var sb = new StringBuffer();
88 expect(() => generator.writeInitCall(sb), throwsA(invalidError));
89 });
90 });
91
66 test('getters, setters, and names', () { 92 test('getters, setters, and names', () {
67 var generator = new SmokeCodeGenerator(); 93 var generator = new SmokeCodeGenerator();
68 generator.addGetter('i'); 94 generator.addGetter('i');
69 generator.addSetter('i'); 95 generator.addSetter('i');
70 generator.addSetter('foo'); 96 generator.addSetter('foo');
71 generator.addSymbol('foo'); 97 generator.addSymbol('foo');
72 checkResults(generator, initCall: 98 checkResults(generator, initCall:
73 'useGeneratedCode(new StaticConfiguration(\n' 99 'useGeneratedCode(new StaticConfiguration(\n'
74 ' checkedMode: false,\n' 100 ' checkedMode: false,\n'
75 ' getters: {\n' 101 ' getters: {\n'
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ' smoke_0.A: {\n' 218 ' smoke_0.A: {\n'
193 ' #foo: const Declaration(#foo, int, isFinal: true),\n' 219 ' #foo: const Declaration(#foo, int, isFinal: true),\n'
194 ' },\n' 220 ' },\n'
195 ' },\n' 221 ' },\n'
196 ' names: {\n' 222 ' names: {\n'
197 ' #c: r\'c\',\n' 223 ' #c: r\'c\',\n'
198 ' #d: r\'d\',\n' 224 ' #d: r\'d\',\n'
199 ' }));\n'); 225 ' }));\n');
200 }); 226 });
201 } 227 }
OLDNEW
« no previous file with comments | « pkg/smoke/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698