Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
WIP #60 fixup test
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjabear committed Sep 28, 2016
1 parent fb2afcc commit 4c9a97c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ fn test_get_task_result_line_str() {

assert_eq!(format!("Task '{}' stderr:\n{}\n", sample_task.name.cyan(), "There's errors".red()), get_task_result_line_str(&sample_task_stdout).1.unwrap());
assert_eq!(get_task_result_line_str(&sample_task_stdout).0,
format!("Task '{}' was started at {}\nTask '{}' stdout:\n{}\n{}{}{}\n", "hello world".cyan(), dt, "hello world".cyan(), "hello world".bold(), "Task '".green(), "hello world".cyan(), "': failed after 20.0s".green()));
format!("Task '{}' was started at {}\nTask '{}' stdout:\n{}\n{}{}{}\n", "hello world".cyan(), dt, "hello world".cyan(), "hello world".bold(), "Task '".red(), "hello world".cyan(), "': failed after 20.0s. Reason: Something about not being in continue job".red()));

// skipped task (previous failure/noop)
let task_skipped = Task::<&FactfileTask> {
Expand Down Expand Up @@ -503,9 +503,7 @@ fn test_get_task_result_line_str() {
on_result: OnResult { terminate_job: vec![], continue_job: vec![] } },
run_result: None
};
// todo: is there a better error here?
// I think this specific case is very unlikely as it'd hint at a problem with the rust stdlib
// it means we've tried to execute a process, but didn't get a return code etc

assert_eq!(format!("Task '{}': {}!\n", "init fail".cyan(), "Factotum could not start the task".red()), get_task_result_line_str(&task_init_fail).0);
assert_eq!(None, get_task_result_line_str(&task_init_fail).1);

Expand All @@ -529,7 +527,7 @@ fn test_get_task_result_line_str() {
})
};

let expected_failed = format!("Task '{}' was started at {}\nTask '{}' stdout:\n{}\n{}{}{}\n", "fails".cyan(), dt, "fails".cyan(), "hello world".bold(), "Task '".red(), "fails".cyan(), "': failed after 20.0s. Reason: The task exited with something unexpected".red());
let expected_failed = format!("Task '{}' was started at {}\nTask '{}' stdout:\n{}\n{}{}{}\n", "fails".cyan(), dt, "fails".cyan(), "hello world".bold(), "Task '".red(), "fails".cyan(), "': couldn't be started. Reason: The task exited with something unexpected".red());
let (stdout_failed, stderr_failed) = get_task_result_line_str(&task_failure);
assert_eq!(expected_failed, stdout_failed);
assert_eq!(format!("Task '{}' stderr:\n{}\n", "fails".cyan(), "There's errors".red()), stderr_failed.unwrap());
Expand Down

0 comments on commit 4c9a97c

Please sign in to comment.