🩹 Mensajes de error en minúscula y corrige test
This commit is contained in:
parent
04dbbc8858
commit
af309930f7
3 changed files with 7 additions and 7 deletions
|
|
@ -213,12 +213,12 @@ impl FromStr for UnitValue {
|
||||||
None => {
|
None => {
|
||||||
let n: f32 = s
|
let n: f32 = s
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(|e| format!("Invalid number `{s}`: {e}"))?;
|
.map_err(|e| format!("invalid number `{s}`: {e}"))?;
|
||||||
if n == 0.0 {
|
if n == 0.0 {
|
||||||
Ok(UnitValue::Zero)
|
Ok(UnitValue::Zero)
|
||||||
} else {
|
} else {
|
||||||
Err(
|
Err(
|
||||||
"Missing unit (expected one of cm,in,mm,pc,pt,px,em,rem,vh,vw, or %)"
|
"missing unit (expected one of cm,in,mm,pc,pt,px,em,rem,vh,vw, or %)"
|
||||||
.to_string(),
|
.to_string(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -230,11 +230,11 @@ impl FromStr for UnitValue {
|
||||||
|
|
||||||
let parse_abs = |n_s: &str| -> Result<isize, String> {
|
let parse_abs = |n_s: &str| -> Result<isize, String> {
|
||||||
n_s.parse::<isize>()
|
n_s.parse::<isize>()
|
||||||
.map_err(|e| format!("Invalid integer `{n_s}`: {e}"))
|
.map_err(|e| format!("invalid integer `{n_s}`: {e}"))
|
||||||
};
|
};
|
||||||
let parse_rel = |n_s: &str| -> Result<f32, String> {
|
let parse_rel = |n_s: &str| -> Result<f32, String> {
|
||||||
n_s.parse::<f32>()
|
n_s.parse::<f32>()
|
||||||
.map_err(|e| format!("Invalid float `{n_s}`: {e}"))
|
.map_err(|e| format!("invalid float `{n_s}`: {e}"))
|
||||||
};
|
};
|
||||||
|
|
||||||
match u.to_ascii_lowercase().as_str() {
|
match u.to_ascii_lowercase().as_str() {
|
||||||
|
|
@ -253,7 +253,7 @@ impl FromStr for UnitValue {
|
||||||
// Porcentaje como unidad.
|
// Porcentaje como unidad.
|
||||||
"%" => Ok(UnitValue::RelPct(parse_rel(n)?)),
|
"%" => Ok(UnitValue::RelPct(parse_rel(n)?)),
|
||||||
// Unidad desconocida.
|
// Unidad desconocida.
|
||||||
_ => Err(format!("Unknown unit: `{u}`")),
|
_ => Err(format!("unknown unit: `{u}`")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ pub fn resolve_absolute_dir<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
||||||
Ok(absolute_dir)
|
Ok(absolute_dir)
|
||||||
} else {
|
} else {
|
||||||
Err({
|
Err({
|
||||||
let msg = format!("Path \"{}\" is not a directory", absolute_dir.display());
|
let msg = format!("path \"{}\" is not a directory", absolute_dir.display());
|
||||||
trace::warn!(msg);
|
trace::warn!(msg);
|
||||||
io::Error::new(io::ErrorKind::InvalidInput, msg)
|
io::Error::new(io::ErrorKind::InvalidInput, msg)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ async fn poweredby_getter_reflects_internal_state() {
|
||||||
|
|
||||||
// Y `new()` lo inicializa con año + nombre de app.
|
// Y `new()` lo inicializa con año + nombre de app.
|
||||||
let p1 = PoweredBy::new();
|
let p1 = PoweredBy::new();
|
||||||
let c1 = p1.copyright().expect("Expected copyright to exis");
|
let c1 = p1.copyright().expect("Expected copyright to exist");
|
||||||
assert!(c1.contains(&Utc::now().format("%Y").to_string()));
|
assert!(c1.contains(&Utc::now().format("%Y").to_string()));
|
||||||
assert!(c1.contains(&global::SETTINGS.app.name));
|
assert!(c1.contains(&global::SETTINGS.app.name));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue