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

Function parse_rejects_malformed_input

atomic-repository/src/manifest.rs:332–352  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

330 /// Structural parse errors are reported distinctly.
331 #[test]
332 fn parse_rejects_malformed_input() {
333 assert!(matches!(ViewManifest::parse(""), Err(ManifestError::Empty)));
334 assert!(matches!(
335 ViewManifest::parse("dev\tshared"),
336 Err(ManifestError::MalformedHeader(_))
337 ));
338 assert!(matches!(
339 ViewManifest::parse("dev\tcosmic\t-\t-"),
340 Err(ManifestError::UnknownScope { .. })
341 ));
342 let bad_hash = "dev\tshared\t-\t-\nnot-a-hash\n";
343 assert!(matches!(
344 ViewManifest::parse(bad_hash),
345 Err(ManifestError::InvalidHash { line: 2, .. })
346 ));
347 let bad_state = "dev\tshared\t-\tzzz!\n";
348 assert!(matches!(
349 ViewManifest::parse(bad_state),
350 Err(ManifestError::InvalidState { .. })
351 ));
352 }
353
354 /// Trailing header fields (future extensions) don't break parsing.
355 #[test]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected