Skip to content
Myr

Add unit tests for merge_exitcodes

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by fusillicode · committed by David Peter · parent 232e393 · Browse files · 3 files+30 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+30 added−2 removed

  • other:+30 added−2 removed

3 files+30 added−2 removed

modified:src/exec/job.rs+1 added-1 removed
5 unmodified lines
6// notice may not be copied, modified, or distributed except7// according to those terms.89use super::CommandTemplate;10use crate::exit_codes::{ExitCode, merge_exitcodes};10use crate::exit_codes::{merge_exitcodes, ExitCode};11use crate::walk::WorkerResult;12use std::path::PathBuf;13use std::sync::mpsc::Receiver;14use std::sync::{Arc, Mutex};
53 unmodified lines
modified:src/exit_codes.rs+28 added
1#[derive(PartialEq, Debug)]2pub enum ExitCode {3 Success,4 GeneralError,5 KilledBySigint,
23 unmodified lines
29 return ExitCode::GeneralError;30 }31 ExitCode::Success32}3334#[cfg(test)]35mod tests {36 use super::*;3738 #[test]39 fn success_with_empty_vec() {40 assert_eq!(merge_exitcodes(vec![]), ExitCode::Success);41 }4243 #[test]44 fn general_error_with_at_least_a_matching_error() {45 assert_eq!(46 merge_exitcodes(vec![ExitCode::KilledBySigint, ExitCode::Success]),47 ExitCode::GeneralError48 );49 assert_eq!(50 merge_exitcodes(vec![ExitCode::GeneralError, ExitCode::Success]),51 ExitCode::GeneralError52 );53 }5455 #[test]56 fn success_with_no_error() {57 assert_eq!(merge_exitcodes(vec![ExitCode::Success]), ExitCode::Success);58 }59}
modified:src/walk.rs+1 added-1 removed
5 unmodified lines
6// notice may not be copied, modified, or distributed except7// according to those terms.89use crate::exec;10use crate::exit_codes::{ExitCode, merge_exitcodes};10use crate::exit_codes::{merge_exitcodes, ExitCode};11use crate::fshelper;12use crate::internal::{opts::FdOptions, osstr_to_bytes, MAX_BUFFER_LENGTH};13use crate::output;14
374 unmodified lines