Skip to content

Commit

Permalink
refactor: remove PartialEq and Eq from Specifier (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Apr 24, 2024
1 parent e6adb88 commit dd6f236
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/specifier.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::error::SpecifierError;
use std::borrow::Cow;

#[derive(Debug, Eq, PartialEq)]
#[derive(Debug)]
pub struct Specifier<'a> {
path: Cow<'a, str>,
pub query: Option<&'a str>,
Expand Down Expand Up @@ -82,14 +82,21 @@ impl<'a> Specifier<'a> {
mod tests {
use super::{Specifier, SpecifierError};

#[test]
fn debug() {
let specifier = Specifier::parse("/").unwrap();
assert_eq!(
format!("{specifier:?}"),
r#"Specifier { path: "/", query: None, fragment: None }"#
);
}

#[test]
fn empty() {
let specifiers = ["", "?"];
for specifier in specifiers {
assert_eq!(
Specifier::parse(specifier),
Err(SpecifierError::Empty(specifier.to_string()))
);
let error = Specifier::parse(specifier).unwrap_err();
assert_eq!(error, SpecifierError::Empty(specifier.to_string()));
}
}

Expand Down

0 comments on commit dd6f236

Please sign in to comment.