| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 expect(() => scope['a'], throwsException); | 288 expect(() => scope['a'], throwsException); |
| 289 }); | 289 }); |
| 290 | 290 |
| 291 test('should return variables', () { | 291 test('should return variables', () { |
| 292 var scope = new Scope(variables: {'a': 'A'}); | 292 var scope = new Scope(variables: {'a': 'A'}); |
| 293 expect(scope['a'], 'A'); | 293 expect(scope['a'], 'A'); |
| 294 }); | 294 }); |
| 295 | 295 |
| 296 test("should a field from the parent's model", () { | 296 test("should a field from the parent's model", () { |
| 297 var parent = new Scope(variables: {'a': 'A', 'b': 'B'}); | 297 var parent = new Scope(variables: {'a': 'A', 'b': 'B'}); |
| 298 var child = new Scope(variables: {'a': 'a'}, parent: parent); | 298 var child = parent.childScope('a', 'a'); |
| 299 expect(child['a'], 'a'); | 299 expect(child['a'], 'a'); |
| 300 expect(parent['a'], 'A'); | 300 expect(parent['a'], 'A'); |
| 301 expect(child['b'], 'B'); | 301 expect(child['b'], 'B'); |
| 302 }); | 302 }); |
| 303 | 303 |
| 304 }); | 304 }); |
| 305 | 305 |
| 306 group('observe', () { | 306 group('observe', () { |
| 307 test('should observe an identifier', () { | 307 test('should observe an identifier', () { |
| 308 var foo = new Foo(name: 'foo'); | 308 var foo = new Foo(name: 'foo'); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 return Future.wait([future, new Future(() { | 429 return Future.wait([future, new Future(() { |
| 430 expect(passed, true, reason: "Didn't receive a change notification on $s"); | 430 expect(passed, true, reason: "Didn't receive a change notification on $s"); |
| 431 })]); | 431 })]); |
| 432 } | 432 } |
| 433 | 433 |
| 434 // Regression test from https://code.google.com/p/dart/issues/detail?id=13459 | 434 // Regression test from https://code.google.com/p/dart/issues/detail?id=13459 |
| 435 class WordElement extends Observable { | 435 class WordElement extends Observable { |
| 436 @observable List chars1 = 'abcdefg'.split(''); | 436 @observable List chars1 = 'abcdefg'.split(''); |
| 437 @reflectable List filteredList(List original) => [original[0], original[1]]; | 437 @reflectable List filteredList(List original) => [original[0], original[1]]; |
| 438 } | 438 } |
| OLD | NEW |