summaryrefslogtreecommitdiff
path: root/src/values/rotation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/values/rotation.rs')
-rw-r--r--src/values/rotation.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/values/rotation.rs b/src/values/rotation.rs
index da291b2..2b609d3 100644
--- a/src/values/rotation.rs
+++ b/src/values/rotation.rs
@@ -25,6 +25,8 @@ impl Value for Rotation {
type Err = ParseRotationError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
+ let s = s.trim();
+
if s.is_empty() {
return Err(ParseRotationError::Empty);
}
@@ -98,13 +100,13 @@ mod tests {
assert_eq!(
Rotation::from_str("3.a"),
Err(ParseRotationError::ParseFloatError(
- f32::from_str("3.a").expect_err("")
+ f32::from_str("3.a").expect_err("float parse should fail")
))
)
}
#[test]
fn cant_parse_empty_string() {
- assert_eq!(Rotation::from_str(""), Err(ParseRotationError::Empty))
+ assert_eq!(Rotation::from_str(" "), Err(ParseRotationError::Empty))
}
}