Upstream rust-syndication/rss state of the touched files before 4fe65d6799
This commit is contained in:
1 parent
40aa38a6ac
commit
4b4bd57cab
2 files changed
+2
-44
No files matched your search
+2
-2
@@ -222,8 +222,8 @@ impl Validate for Image {
|
||||
if let Some(height) = self.height() {
|
||||
let height = height.parse::<i64>()?;
|
||||
validate!(
|
||||
(0..=400).contains(&height),
|
||||
"Image height is not between 0 and 400"
|
||||
(0..=144).contains(&height),
|
||||
"Image height is not between 0 and 144"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#![cfg(feature = "validation")]
|
||||
|
||||
use rss::validation::Validate;
|
||||
use rss::ImageBuilder;
|
||||
|
||||
fn image_with_height(height: &str) -> rss::Image {
|
||||
ImageBuilder::default()
|
||||
.url("https://example.com/image.png".to_string())
|
||||
.link("https://example.com/".to_string())
|
||||
.title("title".to_string())
|
||||
.height(height.to_string())
|
||||
.build()
|
||||
}
|
||||
|
||||
fn image_with_width(width: &str) -> rss::Image {
|
||||
ImageBuilder::default()
|
||||
.url("https://example.com/image.png".to_string())
|
||||
.link("https://example.com/".to_string())
|
||||
.title("title".to_string())
|
||||
.width(width.to_string())
|
||||
.build()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn image_height_allows_up_to_400() {
|
||||
// The RSS 2.0 specification sets the maximum image height to 400.
|
||||
assert!(image_with_height("31").validate().is_ok());
|
||||
assert!(image_with_height("200").validate().is_ok());
|
||||
assert!(image_with_height("400").validate().is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn image_height_above_400_is_invalid() {
|
||||
assert!(image_with_height("401").validate().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn image_width_max_is_still_144() {
|
||||
// Width keeps its specification maximum of 144.
|
||||
assert!(image_with_width("144").validate().is_ok());
|
||||
assert!(image_with_width("145").validate().is_err());
|
||||
}
|
||||
Reference in new issue
Block a user