| 1429 | |
| 1430 | #[test] |
| 1431 | fn test_all() { |
| 1432 | let expected = Ok(FormatSpec { |
| 1433 | conversion: None, |
| 1434 | fill: Some('<'.into()), |
| 1435 | align: Some(FormatAlign::Right), |
| 1436 | sign: Some(FormatSign::Minus), |
| 1437 | alternate_form: true, |
| 1438 | width: Some(23), |
| 1439 | grouping_option: Some(FormatGrouping::Comma), |
| 1440 | precision: Some(11), |
| 1441 | format_type: Some(FormatType::Binary), |
| 1442 | }); |
| 1443 | assert_eq!(FormatSpec::parse("<>-#23,.11b"), expected); |
| 1444 | } |
| 1445 | |
| 1446 | fn format_bool(text: &str, value: bool) -> Result<String, FormatSpecError> { |
| 1447 | FormatSpec::parse(text).and_then(|spec| spec.format_bool(value)) |