MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_from_name

Function test_from_name

atomic-core/src/change/encoding.rs:454–474  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

452
453 #[test]
454 fn test_from_name() {
455 // Standard names
456 assert_eq!(Encoding::from_name("utf-8"), Some(Encoding::Utf8));
457 assert_eq!(Encoding::from_name("UTF-8"), Some(Encoding::Utf8));
458 assert_eq!(Encoding::from_name("utf8"), Some(Encoding::Utf8));
459
460 // UTF-16 variants
461 assert_eq!(Encoding::from_name("utf-16le"), Some(Encoding::Utf16Le));
462 assert_eq!(Encoding::from_name("utf-16be"), Some(Encoding::Utf16Be));
463
464 // Latin-1 aliases
465 assert_eq!(Encoding::from_name("latin1"), Some(Encoding::Latin1));
466 assert_eq!(Encoding::from_name("iso-8859-1"), Some(Encoding::Latin1));
467
468 // Binary
469 assert_eq!(Encoding::from_name("binary"), Some(Encoding::Binary));
470 assert_eq!(Encoding::from_name("bin"), Some(Encoding::Binary));
471
472 // Unknown
473 assert_eq!(Encoding::from_name("unknown"), None);
474 }
475
476 // Extension Tests
477

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected