metainfo parsing

This commit is contained in:
2016-12-11 20:28:12 -05:00
parent 634c82f09e
commit 881c1e2b01
6 changed files with 196 additions and 12 deletions

View File

@@ -57,7 +57,7 @@ fn test_int_neg() {
fn test_bytes() {
use bencode::Bytes;
assert_eq!(encode(Bytes::new(b"hello".to_vec())), b"5:hello");
assert_eq!(encode(Bytes::wrap(b"hello".to_vec())), b"5:hello");
}
#[test]
@@ -65,7 +65,7 @@ fn test_list() {
use bencode::List;
let list = vec![Object::Int(1), Object::Int(2), Object::Int(3)];
assert_eq!(encode(List::new(list)), b"li1ei2ei3ee");
assert_eq!(encode(List::wrap(list)), b"li1ei2ei3ee");
}
#[test]
@@ -75,5 +75,5 @@ fn test_dict() {
let mut dict = BTreeMap::new();
dict.insert(Bytes(b"hello".to_vec()), Object::Int(1337));
assert_eq!(encode(Dict::new(dict)), b"d5:helloi1337ee")
assert_eq!(encode(Dict::wrap(dict)), b"d5:helloi1337ee")
}