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

Side by Side Diff: pkg/polymer_expressions/test/eval_test.dart

Issue 24096016: PolymerExpressions: fix for null iterators in comprehensions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/polymer_expressions/lib/eval.dart ('k') | pkg/polymer_expressions/test/syntax_test.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 eval_test; 5 library eval_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:polymer_expressions/eval.dart'; 9 import 'package:polymer_expressions/eval.dart';
10 import 'package:polymer_expressions/filter.dart'; 10 import 'package:polymer_expressions/filter.dart';
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 test('should evaluate an "in" expression', () { 190 test('should evaluate an "in" expression', () {
191 var scope = new Scope(variables: {'items': [1, 2, 3]}); 191 var scope = new Scope(variables: {'items': [1, 2, 3]});
192 var comprehension = eval(parse('item in items'), scope); 192 var comprehension = eval(parse('item in items'), scope);
193 expect(comprehension.iterable, orderedEquals([1, 2, 3])); 193 expect(comprehension.iterable, orderedEquals([1, 2, 3]));
194 }); 194 });
195 195
196 test('should handle null iterators in "in" expressions', () { 196 test('should handle null iterators in "in" expressions', () {
197 var scope = new Scope(variables: {'items': null}); 197 var scope = new Scope(variables: {'items': null});
198 var comprehension = eval(parse('item in items'), scope); 198 var comprehension = eval(parse('item in items'), scope);
199 expect(comprehension, isNotNull); 199 expect(comprehension, isNotNull);
200 expect(comprehension.iterable, null); 200 expect(comprehension.iterable, []]);
201 }); 201 });
202 202
203 }); 203 });
204 204
205 group('assign', () { 205 group('assign', () {
206 206
207 test('should assign a single identifier', () { 207 test('should assign a single identifier', () {
208 var foo = new Foo(name: 'a'); 208 var foo = new Foo(name: 'a');
209 assign(parse('name'), 'b', new Scope(model: foo)); 209 assign(parse('name'), 'b', new Scope(model: foo));
210 expect(foo.name, 'b'); 210 expect(foo.name, 'b');
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 expect(value, afterMatcher); 379 expect(value, afterMatcher);
380 expect(observer.currentValue, afterMatcher); 380 expect(observer.currentValue, afterMatcher);
381 passed = true; 381 passed = true;
382 }); 382 });
383 mutate(); 383 mutate();
384 // fail if we don't receive an update by the next event loop 384 // fail if we don't receive an update by the next event loop
385 return Future.wait([future, new Future(() { 385 return Future.wait([future, new Future(() {
386 expect(passed, true, reason: "Didn't receive a change notification on $s"); 386 expect(passed, true, reason: "Didn't receive a change notification on $s");
387 })]); 387 })]);
388 } 388 }
OLDNEW
« no previous file with comments | « pkg/polymer_expressions/lib/eval.dart ('k') | pkg/polymer_expressions/test/syntax_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698