libcollections: Remove most uses of `~str` from `libcollections`

This commit is contained in:
Patrick Walton 2014-05-13 18:01:54 -07:00
parent dfe021625a
commit 1ef8246946
1 changed files with 12 additions and 12 deletions

View File

@ -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]