()
| 441 | #[test] |
| 442 | #[ignore] |
| 443 | fn test_named_simple_struct() { |
| 444 | let data_file_path = get_data_file(); |
| 445 | let bytes = fs::read(&data_file_path).unwrap(); |
| 446 | let mut fory = Fory::builder().compatible(true).xlang(true).build(); |
| 447 | fory.register_by_name::<Color>("demo.color").unwrap(); |
| 448 | fory.register_by_name::<Item>("demo.item").unwrap(); |
| 449 | fory.register_by_name::<SimpleStruct>("demo.simple_struct") |
| 450 | .unwrap(); |
| 451 | |
| 452 | let local_obj = SimpleStruct { |
| 453 | f1: HashMap::from([(1, 1.0f64), (2, 2.0f64)]), |
| 454 | f2: 39, |
| 455 | f3: Item { |
| 456 | name: "item".to_string(), |
| 457 | }, |
| 458 | f4: "f4".to_string(), |
| 459 | f5: Color::White, |
| 460 | f6: vec!["f6".to_string()], |
| 461 | f7: 40, |
| 462 | f8: 41, |
| 463 | last: 42, |
| 464 | }; |
| 465 | let remote_obj: SimpleStruct = fory.deserialize(&bytes).unwrap(); |
| 466 | assert_eq!(remote_obj, local_obj); |
| 467 | let new_bytes = fory.serialize(&remote_obj).unwrap(); |
| 468 | let new_local_obj: SimpleStruct = fory.deserialize(&new_bytes).unwrap(); |
| 469 | assert_eq!(new_local_obj, local_obj); |
| 470 | fs::write(&data_file_path, new_bytes).unwrap(); |
| 471 | } |
| 472 | |
| 473 | #[test] |
| 474 | #[ignore] |
nothing calls this directly
no test coverage detected