mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.
This commit is contained in:
parent
cf616b90a2
commit
16c7060bc8
153 changed files with 2095 additions and 1298 deletions
|
@ -69,14 +69,12 @@ impl<K,V> HashCache<K,V> where K: Clone + PartialEq + Eq + Hash, V: Clone {
|
|||
#[test]
|
||||
fn test_hashcache() {
|
||||
let mut cache: HashCache<uint, Cell<&str>> = HashCache::new();
|
||||
let one = Cell::new("one");
|
||||
let two = Cell::new("two");
|
||||
|
||||
cache.insert(1, one);
|
||||
cache.insert(1, Cell::new("one"));
|
||||
assert!(cache.find(&1).is_some());
|
||||
assert!(cache.find(&2).is_none());
|
||||
|
||||
cache.find_or_create(&2, |_v| { two });
|
||||
cache.find_or_create(&2, |_v| { Cell::new("two") });
|
||||
assert!(cache.find(&1).is_some());
|
||||
assert!(cache.find(&2).is_some());
|
||||
}
|
||||
|
@ -233,7 +231,7 @@ fn test_lru_cache() {
|
|||
assert!(cache.find(&4).is_some()); // (2, 4) (no change)
|
||||
|
||||
// Test find_or_create.
|
||||
cache.find_or_create(&1, |_| { one }); // (4, 1)
|
||||
cache.find_or_create(&1, |_| { Cell::new("one") }); // (4, 1)
|
||||
|
||||
assert!(cache.find(&1).is_some()); // (4, 1) (no change)
|
||||
assert!(cache.find(&2).is_none()); // (4, 1) (no change)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue