feat: add tests for git setup

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-07-29 19:23:05 +02:00
parent ff9b61ee4a
commit 5e26707e42
7 changed files with 86 additions and 19 deletions

View File

@@ -2,6 +2,7 @@ use cuddle_please::ui::{DynUi, Ui};
use std::{
io::Write,
path::PathBuf,
sync::{Arc, Mutex},
};
@@ -111,3 +112,17 @@ impl From<&BufferUi> for DynUi {
value.clone().into()
}
}
pub fn assert_output(ui: &BufferUi, expected_stdout: &str, expected_stderr: &str) {
let (stdout, stderr) = ui.get_output();
assert_eq!(expected_stdout, &stdout);
assert_eq!(expected_stderr, &stderr);
}
pub fn get_test_data_path(item: &str) -> PathBuf {
std::env::current_dir()
.ok()
.map(|p| p.join("testdata").join(item))
.unwrap()
}