| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |