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 mirrors to cause all mirrors to be retained by dart2js. | 9 // Import mirrors to cause all mirrors to be retained by dart2js. |
10 // The tests reflect on LinkedHashMap.length and String.length. | 10 // The tests reflect on LinkedHashMap.length and String.length. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 test('should return a literal boolean', () { | 50 test('should return a literal boolean', () { |
51 expectEval('true', true); | 51 expectEval('true', true); |
52 expectEval('false', false); | 52 expectEval('false', false); |
53 }); | 53 }); |
54 | 54 |
55 test('should return a literal null', () { | 55 test('should return a literal null', () { |
56 expectEval('null', null); | 56 expectEval('null', null); |
57 }); | 57 }); |
58 | 58 |
| 59 test('should return a literal list', () { |
| 60 expectEval('[1, 2, 3]', equals([1, 2, 3])); |
| 61 }); |
| 62 |
59 test('should return a literal map', () { | 63 test('should return a literal map', () { |
60 expectEval('{"a": 1}', equals(new Map.from({'a': 1}))); | 64 expectEval('{"a": 1}', equals(new Map.from({'a': 1}))); |
61 expectEval('{"a": 1}', containsPair('a', 1)); | 65 expectEval('{"a": 1}', containsPair('a', 1)); |
62 }); | 66 }); |
63 | 67 |
64 test('should call methods on a literal map', () { | 68 test('should call methods on a literal map', () { |
65 expectEval('{"a": 1}.length', 1); | 69 expectEval('{"a": 1}.length', 1); |
66 }); | 70 }); |
67 | 71 |
68 test('should evaluate unary operators', () { | 72 test('should evaluate unary operators', () { |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 return Future.wait([future, new Future(() { | 410 return Future.wait([future, new Future(() { |
407 expect(passed, true, reason: "Didn't receive a change notification on $s"); | 411 expect(passed, true, reason: "Didn't receive a change notification on $s"); |
408 })]); | 412 })]); |
409 } | 413 } |
410 | 414 |
411 // Regression test from https://code.google.com/p/dart/issues/detail?id=13459 | 415 // Regression test from https://code.google.com/p/dart/issues/detail?id=13459 |
412 class WordElement extends Observable { | 416 class WordElement extends Observable { |
413 @observable List chars1 = 'abcdefg'.split(''); | 417 @observable List chars1 = 'abcdefg'.split(''); |
414 @reflectable List filteredList(List original) => [original[0], original[1]]; | 418 @reflectable List filteredList(List original) => [original[0], original[1]]; |
415 } | 419 } |
OLD | NEW |