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

Function test_exit_codes

atomic-core/src/crdt/apply/error.rs:1001–1024  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

999
1000 #[test]
1001 fn test_exit_codes() {
1002 let trunk_id = TrunkId::new(NodeId::new(1), 0);
1003
1004 // User errors get exit code 2
1005 assert_eq!(ApplyError::trunk_not_found(trunk_id).exit_code(), 2);
1006 assert_eq!(ApplyError::trunk_already_exists(trunk_id).exit_code(), 2);
1007 assert_eq!(
1008 ApplyError::invalid_trunk_state(trunk_id, "s", "o").exit_code(),
1009 2
1010 );
1011
1012 // Data format errors get exit code 65
1013 assert_eq!(ApplyError::content_out_of_bounds(0, 1, 0).exit_code(), 65);
1014 assert_eq!(ApplyError::circular_reference("test").exit_code(), 65);
1015
1016 // I/O errors get exit code 74
1017 let pristine_err = PristineError::ViewNotFound {
1018 name: "test".to_string(),
1019 };
1020 assert_eq!(ApplyError::storage(pristine_err, "test").exit_code(), 74);
1021
1022 // Internal errors get exit code 70
1023 assert_eq!(ApplyError::internal("bug").exit_code(), 70);
1024 }
1025
1026 // Display and Debug Tests
1027

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected