Skip to content

Commit

Permalink
libcollections: Remove most uses of ~str from libcollections
Browse files Browse the repository at this point in the history
  • Loading branch information
pcwalton committed May 15, 2014
1 parent dfe0216 commit 1ef8246
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/libcollections/lru_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,23 +270,23 @@ mod tests {

#[test]
fn test_put_update() {
let mut cache: LruCache<~str, Vec<u8>> = LruCache::new(1);
cache.put("1".to_owned(), vec![10, 10]);
cache.put("1".to_owned(), vec![10, 19]);
assert_opt_eq(cache.get(&"1".to_owned()), vec![10, 19]);
let mut cache: LruCache<StrBuf, Vec<u8>> = LruCache::new(1);
cache.put("1".to_strbuf(), vec![10, 10]);
cache.put("1".to_strbuf(), vec![10, 19]);
assert_opt_eq(cache.get(&"1".to_strbuf()), vec![10, 19]);
assert_eq!(cache.len(), 1);
}

#[test]
fn test_expire_lru() {
let mut cache: LruCache<~str, ~str> = LruCache::new(2);
cache.put("foo1".to_owned(), "bar1".to_owned());
cache.put("foo2".to_owned(), "bar2".to_owned());
cache.put("foo3".to_owned(), "bar3".to_owned());
assert!(cache.get(&"foo1".to_owned()).is_none());
cache.put("foo2".to_owned(), "bar2update".to_owned());
cache.put("foo4".to_owned(), "bar4".to_owned());
assert!(cache.get(&"foo3".to_owned()).is_none());
let mut cache: LruCache<StrBuf, StrBuf> = LruCache::new(2);
cache.put("foo1".to_strbuf(), "bar1".to_strbuf());
cache.put("foo2".to_strbuf(), "bar2".to_strbuf());
cache.put("foo3".to_strbuf(), "bar3".to_strbuf());
assert!(cache.get(&"foo1".to_strbuf()).is_none());
cache.put("foo2".to_strbuf(), "bar2update".to_strbuf());
cache.put("foo4".to_strbuf(), "bar4".to_strbuf());
assert!(cache.get(&"foo3".to_strbuf()).is_none());
}

#[test]
Expand Down

0 comments on commit 1ef8246

Please sign in to comment.