| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.test.src.util.lru_map_test; | 5 library analyzer.test.src.util.lru_map_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/util/lru_map.dart'; | 7 import 'package:analyzer/src/util/lru_map.dart'; |
| 8 import 'package:test/test.dart'; |
| 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 9 import 'package:unittest/unittest.dart'; | |
| 10 | 10 |
| 11 import '../../utils.dart'; | 11 import '../../utils.dart'; |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 initializeTestEnvironment(); | 14 initializeTestEnvironment(); |
| 15 defineReflectiveTests(_LRUCacheTest); | 15 defineReflectiveSuite(() { |
| 16 defineReflectiveTests(_LRUCacheTest); |
| 17 }); |
| 16 } | 18 } |
| 17 | 19 |
| 18 @reflectiveTest | 20 @reflectiveTest |
| 19 class _LRUCacheTest { | 21 class _LRUCacheTest { |
| 20 LRUMap<int, String> cache = new LRUMap<int, String>(3); | 22 LRUMap<int, String> cache = new LRUMap<int, String>(3); |
| 21 | 23 |
| 22 void test_evict_notGet() { | 24 void test_evict_notGet() { |
| 23 List<int> evictedKeys = new List<int>(); | 25 List<int> evictedKeys = new List<int>(); |
| 24 List<String> evictedValues = new List<String>(); | 26 List<String> evictedValues = new List<String>(); |
| 25 cache = new LRUMap<int, String>(3, (int key, String value) { | 27 cache = new LRUMap<int, String>(3, (int key, String value) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 cache.put(3, 'C'); | 89 cache.put(3, 'C'); |
| 88 // remove | 90 // remove |
| 89 cache.remove(1); | 91 cache.remove(1); |
| 90 cache.remove(3); | 92 cache.remove(3); |
| 91 // check | 93 // check |
| 92 expect(cache.get(1), isNull); | 94 expect(cache.get(1), isNull); |
| 93 expect(cache.get(2), 'B'); | 95 expect(cache.get(2), 'B'); |
| 94 expect(cache.get(3), isNull); | 96 expect(cache.get(3), isNull); |
| 95 } | 97 } |
| 96 } | 98 } |
| OLD | NEW |