MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_fill_and_align

Function test_fill_and_align

crates/common/src/format.rs:1367–1396  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1365
1366 #[test]
1367 fn test_fill_and_align() {
1368 let parse_fill_and_align = |text| {
1369 let (fill, align, rest) = parse_fill_and_align(str::as_ref(text));
1370 (
1371 fill.and_then(CodePoint::to_char),
1372 align,
1373 rest.as_str().unwrap(),
1374 )
1375 };
1376 assert_eq!(
1377 parse_fill_and_align(" <"),
1378 (Some(' '), Some(FormatAlign::Left), "")
1379 );
1380 assert_eq!(
1381 parse_fill_and_align(" <22"),
1382 (Some(' '), Some(FormatAlign::Left), "22")
1383 );
1384 assert_eq!(
1385 parse_fill_and_align("<22"),
1386 (None, Some(FormatAlign::Left), "22")
1387 );
1388 assert_eq!(
1389 parse_fill_and_align(" ^^"),
1390 (Some(' '), Some(FormatAlign::Center), "^")
1391 );
1392 assert_eq!(
1393 parse_fill_and_align("==="),
1394 (Some('='), Some(FormatAlign::AfterSign), "=")
1395 );
1396 }
1397
1398 #[test]
1399 fn test_width_only() {

Callers

nothing calls this directly

Calls 3

parse_fill_and_alignFunction · 0.85
unwrapMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected