From 2a13c61803fa8632d75f57e853f78bdbb0fe264f Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Fri, 21 May 2021 21:20:54 +0900 Subject: [PATCH] Add test. --- src/schema/facet.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/schema/facet.rs b/src/schema/facet.rs index d2f7fb7ef5..7a59f95d8a 100644 --- a/src/schema/facet.rs +++ b/src/schema/facet.rs @@ -24,7 +24,7 @@ pub const FACET_SEP_CHAR: char = '\u{0}'; #[derive(Debug, PartialEq, Eq, Error)] pub enum FacetParseError { /// The facet text representation is unparsable. - #[error("Failed to parse the facet string: '{0:?}'")] + #[error("Failed to parse the facet string: '{0}'")] FacetParseError(String), } @@ -238,7 +238,7 @@ impl Debug for Facet { #[cfg(test)] mod tests { - use super::Facet; + use super::{Facet, FacetParseError}; #[test] fn test_root() { @@ -300,4 +300,12 @@ mod tests { let facet = Facet::from_path(v.iter()); assert_eq!(facet.to_path_string(), "/"); } + + #[test] + fn test_from_text() { + assert_eq!( + Err(FacetParseError::FacetParseError("Failed to parse the facet string: 'INVALID'".to_string())), + Facet::from_text("INVALID") + ); + } }