Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sciencentistguy committed Apr 21, 2024
1 parent c6c66b9 commit 16bcd47
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,31 +150,31 @@ mod tests {
#[test]
fn test_parsing_nightly() {
assert_eq!(
parse_channel_str("nightly-2022-01-01"),
RustChannel::from_str("nightly-2022-01-01"),
Ok(RustChannel::DatedNightly("2022-01-01".to_string()))
);
assert!(parse_channel_str("nightly-01/01/2022").is_err());
assert!(parse_channel_str("nightly-2022-1-1").is_err());
assert!(RustChannel::from_str("nightly-01/01/2022").is_err());
assert!(RustChannel::from_str("nightly-2022-1-1").is_err());
}
#[test]
fn test_parsing_version() {
assert_eq!(
parse_channel_str("1.59"),
RustChannel::from_str("1.59"),
Ok(RustChannel::Version("1.59".to_string()))
);
assert_eq!(
parse_channel_str("1.58.1"),
RustChannel::from_str("1.58.1"),
Ok(RustChannel::Version("1.58.1".to_string()))
);
assert!(parse_channel_str("1.58.1.5").is_err());
assert!(RustChannel::from_str("1.58.1.5").is_err());
}

#[test]
fn test_parsing_strings() {
assert_eq!(parse_channel_str("stable"), Ok(RustChannel::Stable));
assert_eq!(parse_channel_str("beta"), Ok(RustChannel::Beta));
assert_eq!(parse_channel_str("nightly"), Ok(RustChannel::Nightly));
assert!(parse_channel_str("nightly-").is_err());
assert!(parse_channel_str("something else").is_err());
assert_eq!(RustChannel::from_str("stable"), Ok(RustChannel::Stable));
assert_eq!(RustChannel::from_str("beta"), Ok(RustChannel::Beta));
assert_eq!(RustChannel::from_str("nightly"), Ok(RustChannel::Nightly));
assert!(RustChannel::from_str("nightly-").is_err());
assert!(RustChannel::from_str("something else").is_err());
}
}

0 comments on commit 16bcd47

Please sign in to comment.