argh
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Cadey Ratio 2020-10-25 16:16:56 -04:00
parent 5c48459414
commit e94e032942
2 changed files with 9 additions and 1 deletions

View File

@ -47,6 +47,7 @@ mod tests {
#[test]
fn read() {
use super::read;
let _ = pretty_env_logger::try_init();
read().unwrap().unwrap();
}
}

View File

@ -4,7 +4,13 @@ use std::{fs, path::PathBuf};
mod cargo;
pub(crate) fn read(fname: PathBuf) -> Result<String> {
let version = read_fs(fname).unwrap_or(cargo::read().unwrap().unwrap());
let version = match read_fs(fname.clone()) {
Ok(version) => version,
Err(why) => {
log::debug!("can't read {:?}: {:?}", fname, why);
cargo::read().unwrap().unwrap()
}
};
Ok(version)
}
@ -17,6 +23,7 @@ fn read_fs(fname: PathBuf) -> Result<String> {
mod tests {
#[test]
fn read_version() {
let _ = pretty_env_logger::try_init();
let version = super::read_fs("./testdata/VERSION".into()).unwrap();
assert_eq!(version, "0.1.0");
}