argh
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
5c48459414
commit
e94e032942
|
@ -47,6 +47,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn read() {
|
fn read() {
|
||||||
use super::read;
|
use super::read;
|
||||||
|
let _ = pretty_env_logger::try_init();
|
||||||
read().unwrap().unwrap();
|
read().unwrap().unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,13 @@ use std::{fs, path::PathBuf};
|
||||||
mod cargo;
|
mod cargo;
|
||||||
|
|
||||||
pub(crate) fn read(fname: PathBuf) -> Result<String> {
|
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)
|
Ok(version)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +23,7 @@ fn read_fs(fname: PathBuf) -> Result<String> {
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn read_version() {
|
fn read_version() {
|
||||||
|
let _ = pretty_env_logger::try_init();
|
||||||
let version = super::read_fs("./testdata/VERSION".into()).unwrap();
|
let version = super::read_fs("./testdata/VERSION".into()).unwrap();
|
||||||
assert_eq!(version, "0.1.0");
|
assert_eq!(version, "0.1.0");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue