OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** Tests for some of the utility helper functions used by the compiler. */ | 5 /** Tests for some of the utility helper functions used by the compiler. */ |
6 library observe_test; | 6 library observe_test; |
7 | 7 |
8 import 'dart:collection' show LinkedHashMap; | 8 import 'dart:collection' show LinkedHashMap; |
9 import 'package:unittest/compact_vm_config.dart'; | 9 import 'package:unittest/compact_vm_config.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 import 'package:web_ui/observe.dart'; | 11 import 'package:web_ui/observe.dart'; |
12 import 'package:web_ui/observe/observable.dart' show hasObservers; | 12 import 'package:web_ui/observe/observable.dart' show hasObservers, observeReads; |
13 import 'package:web_ui/src/utils_observe.dart' show setImmediate; | 13 import 'package:web_ui/src/utils_observe.dart' show setImmediate; |
14 | 14 |
15 main() { | 15 main() { |
16 useCompactVMConfiguration(); | 16 useCompactVMConfiguration(); |
17 | 17 |
18 group('ObservableReference', () { | 18 group('ObservableReference', () { |
19 test('no observers', () { | 19 test('no observers', () { |
20 var t = new ObservableReference<int>(123); | 20 var t = new ObservableReference<int>(123); |
21 expect(t.value, 123); | 21 expect(t.value, 123); |
22 t.value = 42; | 22 t.value = 42; |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 var c = _change(123, 43); | 870 var c = _change(123, 43); |
871 expect(a.hashCode, b.hashCode, reason: 'a == b'); | 871 expect(a.hashCode, b.hashCode, reason: 'a == b'); |
872 expect(b.hashCode, isNot(equals(c.hashCode)), reason: 'b != c'); | 872 expect(b.hashCode, isNot(equals(c.hashCode)), reason: 'b != c'); |
873 }); | 873 }); |
874 } | 874 } |
875 | 875 |
876 _change(oldValue, newValue) => new ChangeNotification(oldValue, newValue); | 876 _change(oldValue, newValue) => new ChangeNotification(oldValue, newValue); |
877 | 877 |
878 _record(type, key, oldValue, newValue) => | 878 _record(type, key, oldValue, newValue) => |
879 new ChangeRecord(type, key, oldValue, newValue); | 879 new ChangeRecord(type, key, oldValue, newValue); |
OLD | NEW |