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:1177–1230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1175
1176 #[test]
1177 fn test_all_error_variants_have_display() {
1178 // Ensure all error variants can be displayed without panicking
1179 let errors: Vec<CliError> = vec![
1180 CliError::repository_not_found("/path"),
1181 CliError::repository_exists("/path"),
1182 CliError::invalid_path("/path", None),
1183 CliError::InvalidRepository {
1184 reason: "corrupted".into(),
1185 },
1186 CliError::view_not_found("main"),
1187 CliError::ViewAlreadyExists { name: "dev".into() },
1188 CliError::CannotDeleteCurrentView { name: "dev".into() },
1189 CliError::file_not_found("test.txt"),
1190 CliError::FileNotTracked {
1191 path: "test.txt".into(),
1192 },
1193 CliError::FileAlreadyTracked {
1194 path: "test.txt".into(),
1195 },
1196 CliError::PathOutsideRepository {
1197 path: "../outside".into(),
1198 },
1199 CliError::NothingToRecord,
1200 CliError::change_not_found("ABC"),
1201 CliError::AmbiguousHash { hash: "AB".into() },
1202 CliError::MissingDependency {
1203 change: "A".into(),
1204 dependency: "B".into(),
1205 },
1206 CliError::Conflict {
1207 description: "conflict".into(),
1208 },
1209 CliError::remote_error("failed", None),
1210 CliError::RemoteNotFound {
1211 name: "origin".into(),
1212 },
1213 CliError::AuthenticationFailed {
1214 remote: "origin".into(),
1215 },
1216 CliError::Cancelled,
1217 CliError::InvalidArgument {
1218 message: "bad".into(),
1219 },
1220 ];
1221
1222 for err in errors {
1223 // Just ensure to_string() doesn't panic
1224 let _ = err.to_string();
1225 // Also ensure suggestion() doesn't panic
1226 let _ = err.suggestion();
1227 // And exit_code() doesn't panic
1228 let _ = err.exit_code();
1229 }
1230 }
1231}

Callers

nothing calls this directly

Calls 2

suggestionMethod · 0.45
exit_codeMethod · 0.45

Tested by

no test coverage detected