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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

suggestionMethod · 0.45
exit_codeMethod · 0.45

Tested by

no test coverage detected