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

Source from the content-addressed store, hash-verified

1300
1301 #[test]
1302 fn test_all_error_variants_have_display() {
1303 // Ensure all error variants can be displayed without panicking
1304 let errors: Vec<CliError> = vec![
1305 CliError::repository_not_found("/path"),
1306 CliError::repository_exists("/path"),
1307 CliError::invalid_path("/path", None),
1308 CliError::InvalidRepository {
1309 reason: "corrupted".into(),
1310 },
1311 CliError::view_not_found("main"),
1312 CliError::ViewAlreadyExists { name: "dev".into() },
1313 CliError::CannotDeleteCurrentView { name: "dev".into() },
1314 CliError::file_not_found("test.txt"),
1315 CliError::FileNotTracked {
1316 path: "test.txt".into(),
1317 },
1318 CliError::FileAlreadyTracked {
1319 path: "test.txt".into(),
1320 },
1321 CliError::PathOutsideRepository {
1322 path: "../outside".into(),
1323 },
1324 CliError::NothingToRecord,
1325 CliError::change_not_found("ABC"),
1326 CliError::AmbiguousHash { hash: "AB".into() },
1327 CliError::MissingDependency {
1328 change: "A".into(),
1329 dependency: "B".into(),
1330 },
1331 CliError::Conflict {
1332 description: "conflict".into(),
1333 },
1334 CliError::remote_error("failed", None),
1335 CliError::RemoteNotFound {
1336 name: "origin".into(),
1337 },
1338 CliError::AuthenticationFailed {
1339 remote: "origin".into(),
1340 },
1341 CliError::Cancelled,
1342 CliError::InvalidArgument {
1343 message: "bad".into(),
1344 },
1345 ];
1346
1347 for err in errors {
1348 // Just ensure to_string() doesn't panic
1349 let _ = err.to_string();
1350 // Also ensure suggestion() doesn't panic
1351 let _ = err.suggestion();
1352 // And exit_code() doesn't panic
1353 let _ = err.exit_code();
1354 }
1355 }
1356}

Callers

nothing calls this directly

Calls 2

suggestionMethod · 0.45
exit_codeMethod · 0.45

Tested by

no test coverage detected