| 1 | mod records { |
| 2 | use rust_apt::new_cache; |
| 3 | use rust_apt::records::RecordField; |
| 4 | |
| 5 | #[test] |
| 6 | fn fields() { |
| 7 | let cache = new_cache!().unwrap(); |
| 8 | |
| 9 | let cand = cache.get("apt").unwrap().candidate().unwrap(); |
| 10 | |
| 11 | assert_eq!( |
| 12 | cand.get_record(RecordField::Maintainer).unwrap(), |
| 13 | "APT Development Team <[email protected]>" |
| 14 | ); |
| 15 | // Apt should not have a homepage |
| 16 | assert!(cand.get_record(RecordField::Homepage).is_none()); |
| 17 | |
| 18 | // This should also equal the same as the cand version |
| 19 | assert_eq!( |
| 20 | cand.get_record(RecordField::Version).unwrap(), |
| 21 | cand.version() |
| 22 | ); |
| 23 | |
| 24 | // We can just print these for good luck. |
| 25 | println!("Depends {:?}", cand.get_record(RecordField::Depends)); |
| 26 | println!("PreDepends {:?}", cand.get_record(RecordField::PreDepends)); |
| 27 | |
| 28 | // This should be the same as what the Hash accessors will give. |
| 29 | assert_eq!(cand.get_record("SHA256"), cand.sha256()); |
| 30 | } |
| 31 | } |