Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
moriyoshi committed May 21, 2021
1 parent e944f48 commit 2a13c61
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/schema/facet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down Expand Up @@ -238,7 +238,7 @@ impl Debug for Facet {
#[cfg(test)]
mod tests {

use super::Facet;
use super::{Facet, FacetParseError};

#[test]
fn test_root() {
Expand Down Expand Up @@ -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")
);
}
}

0 comments on commit 2a13c61

Please sign in to comment.