()
| 1080 | |
| 1081 | #[test] |
| 1082 | fn test_all_error_variants_have_display() { |
| 1083 | // Ensure all error variants can be displayed without panicking |
| 1084 | let errors: Vec<CliError> = vec![ |
| 1085 | CliError::repository_not_found("/path"), |
| 1086 | CliError::repository_exists("/path"), |
| 1087 | CliError::invalid_path("/path", None), |
| 1088 | CliError::InvalidRepository { |
| 1089 | reason: "corrupted".into(), |
| 1090 | }, |
| 1091 | CliError::view_not_found("main"), |
| 1092 | CliError::ViewAlreadyExists { name: "dev".into() }, |
| 1093 | CliError::CannotDeleteCurrentView { name: "dev".into() }, |
| 1094 | CliError::file_not_found("test.txt"), |
| 1095 | CliError::FileNotTracked { |
| 1096 | path: "test.txt".into(), |
| 1097 | }, |
| 1098 | CliError::FileAlreadyTracked { |
| 1099 | path: "test.txt".into(), |
| 1100 | }, |
| 1101 | CliError::PathOutsideRepository { |
| 1102 | path: "../outside".into(), |
| 1103 | }, |
| 1104 | CliError::NothingToRecord, |
| 1105 | CliError::change_not_found("ABC"), |
| 1106 | CliError::AmbiguousHash { hash: "AB".into() }, |
| 1107 | CliError::MissingDependency { |
| 1108 | change: "A".into(), |
| 1109 | dependency: "B".into(), |
| 1110 | }, |
| 1111 | CliError::Conflict { |
| 1112 | description: "conflict".into(), |
| 1113 | }, |
| 1114 | CliError::remote_error("failed", None), |
| 1115 | CliError::RemoteNotFound { |
| 1116 | name: "origin".into(), |
| 1117 | }, |
| 1118 | CliError::AuthenticationFailed { |
| 1119 | remote: "origin".into(), |
| 1120 | }, |
| 1121 | CliError::Cancelled, |
| 1122 | CliError::InvalidArgument { |
| 1123 | message: "bad".into(), |
| 1124 | }, |
| 1125 | ]; |
| 1126 | |
| 1127 | for err in errors { |
| 1128 | // Just ensure to_string() doesn't panic |
| 1129 | let _ = err.to_string(); |
| 1130 | // Also ensure suggestion() doesn't panic |
| 1131 | let _ = err.suggestion(); |
| 1132 | // And exit_code() doesn't panic |
| 1133 | let _ = err.exit_code(); |
| 1134 | } |
| 1135 | } |
| 1136 | } |
nothing calls this directly
no test coverage detected