Chromium Code Reviews| 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 // NOTE: this import is unused, but we use it to cause all mirrors to be | 9 // NOTE: this import is unused, but we use it to cause all mirrors to be |
|
Siggi Cherem (dart-lang)
2013/10/23 01:41:11
rereading this, sounds funny =): it's unused, but
Jennifer Messerly
2013/10/23 02:05:02
Done.
| |
| 10 // enabled. The tests reflect on LinkedHashMap.length and String.length. | 10 // enabled. The tests reflect on LinkedHashMap.length and String.length. |
| 11 import 'dart:mirrors'; | 11 import 'dart:mirrors'; |
| 12 | 12 |
| 13 import 'package:polymer_expressions/eval.dart'; | 13 import 'package:polymer_expressions/eval.dart'; |
| 14 import 'package:polymer_expressions/filter.dart'; | 14 import 'package:polymer_expressions/filter.dart'; |
| 15 import 'package:polymer_expressions/parser.dart'; | 15 import 'package:polymer_expressions/parser.dart'; |
| 16 import 'package:unittest/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
| 17 import 'package:observe/observe.dart'; | 17 import 'package:observe/observe.dart'; |
| 18 | 18 |
| 19 main() { | 19 main() { |
| 20 reflectClass(Object); // suppress unused import warning | |
| 20 | 21 |
| 21 group('eval', () { | 22 group('eval', () { |
| 22 test('should return the model for an empty expression', () { | 23 test('should return the model for an empty expression', () { |
| 23 expectEval('', 'model', 'model'); | 24 expectEval('', 'model', 'model'); |
| 24 }); | 25 }); |
| 25 | 26 |
| 26 test('should handle the "this" keyword', () { | 27 test('should handle the "this" keyword', () { |
| 27 expectEval('this', 'model', 'model'); | 28 expectEval('this', 'model', 'model'); |
| 28 expectEval('this.name', 'foo', new Foo(name: 'foo')); | 29 expectEval('this.name', 'foo', new Foo(name: 'foo')); |
| 29 expectEval('this["a"]', 'x', {'a': 'x'}); | 30 expectEval('this["a"]', 'x', {'a': 'x'}); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 return Future.wait([future, new Future(() { | 396 return Future.wait([future, new Future(() { |
| 396 expect(passed, true, reason: "Didn't receive a change notification on $s"); | 397 expect(passed, true, reason: "Didn't receive a change notification on $s"); |
| 397 })]); | 398 })]); |
| 398 } | 399 } |
| 399 | 400 |
| 400 // Regression test from https://code.google.com/p/dart/issues/detail?id=13459 | 401 // Regression test from https://code.google.com/p/dart/issues/detail?id=13459 |
| 401 class WordElement extends Observable { | 402 class WordElement extends Observable { |
| 402 @observable List chars1 = 'abcdefg'.split(''); | 403 @observable List chars1 = 'abcdefg'.split(''); |
| 403 @reflectable List filteredList(List original) => [original[0], original[1]]; | 404 @reflectable List filteredList(List original) => [original[0], original[1]]; |
| 404 } | 405 } |
| OLD | NEW |