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

Function test_all_error_variants_have_display

atomic-cli/src/error.rs:1064–1117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1062
1063 #[test]
1064 fn test_all_error_variants_have_display() {
1065 // Ensure all error variants can be displayed without panicking
1066 let errors: Vec<CliError> = vec![
1067 CliError::repository_not_found("/path"),
1068 CliError::repository_exists("/path"),
1069 CliError::invalid_path("/path", None),
1070 CliError::InvalidRepository {
1071 reason: "corrupted".into(),
1072 },
1073 CliError::view_not_found("main"),
1074 CliError::ViewAlreadyExists { name: "dev".into() },
1075 CliError::CannotDeleteCurrentView { name: "dev".into() },
1076 CliError::file_not_found("test.txt"),
1077 CliError::FileNotTracked {
1078 path: "test.txt".into(),
1079 },
1080 CliError::FileAlreadyTracked {
1081 path: "test.txt".into(),
1082 },
1083 CliError::PathOutsideRepository {
1084 path: "../outside".into(),
1085 },
1086 CliError::NothingToRecord,
1087 CliError::change_not_found("ABC"),
1088 CliError::AmbiguousHash { hash: "AB".into() },
1089 CliError::MissingDependency {
1090 change: "A".into(),
1091 dependency: "B".into(),
1092 },
1093 CliError::Conflict {
1094 description: "conflict".into(),
1095 },
1096 CliError::remote_error("failed", None),
1097 CliError::RemoteNotFound {
1098 name: "origin".into(),
1099 },
1100 CliError::AuthenticationFailed {
1101 remote: "origin".into(),
1102 },
1103 CliError::Cancelled,
1104 CliError::InvalidArgument {
1105 message: "bad".into(),
1106 },
1107 ];
1108
1109 for err in errors {
1110 // Just ensure to_string() doesn't panic
1111 let _ = err.to_string();
1112 // Also ensure suggestion() doesn't panic
1113 let _ = err.suggestion();
1114 // And exit_code() doesn't panic
1115 let _ = err.exit_code();
1116 }
1117 }
1118}

Callers

nothing calls this directly

Calls 2

suggestionMethod · 0.45
exit_codeMethod · 0.45

Tested by

no test coverage detected