| 370 | |
| 371 | #[test] |
| 372 | fn wants_roundtrip_and_all_helper() { |
| 373 | let wants = SyncWants::all(vec!["aa".to_string(), "bb".to_string()]); |
| 374 | assert!(wants.wants_all()); |
| 375 | let bytes = wants.encode().expect("encode"); |
| 376 | assert_eq!(SyncWants::decode(&bytes).expect("decode"), wants); |
| 377 | |
| 378 | let scoped = SyncWants { |
| 379 | refs: vec!["dev".to_string()], |
| 380 | haves: vec![], |
| 381 | refs_only: false, |
| 382 | }; |
| 383 | assert!(!scoped.wants_all()); |
| 384 | |
| 385 | let adv = SyncWants::advertise(vec!["dev".to_string()]); |
| 386 | assert!(adv.refs_only); |
| 387 | assert!(!adv.wants_all()); |
| 388 | assert_eq!(SyncWants::decode(&adv.encode().unwrap()).unwrap(), adv); |
| 389 | } |
| 390 | |
| 391 | #[test] |
| 392 | fn empty_pack_is_empty() { |