2020-05-17 19:54:07 +02:00
|
|
|
// ██████╗ █████╗ ███████╗███████╗██╗███╗ ██╗ ██████╗
|
|
|
|
// ██╔══██╗██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝
|
|
|
|
// ██████╔╝███████║███████╗███████╗██║██╔██╗ ██║██║ ███╗
|
|
|
|
// ██╔═══╝ ██╔══██║╚════██║╚════██║██║██║╚██╗██║██║ ██║
|
|
|
|
// ██║ ██║ ██║███████║███████║██║██║ ╚████║╚██████╔╝
|
|
|
|
// ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod passing {
|
|
|
|
use reqwest::blocking::Client;
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
2020-06-28 07:36:41 +02:00
|
|
|
use crate::html;
|
|
|
|
use crate::opts::Options;
|
|
|
|
|
2020-05-17 19:54:07 +02:00
|
|
|
#[test]
|
|
|
|
fn replace_with_empty_images() {
|
|
|
|
let cache = &mut HashMap::new();
|
|
|
|
let client = Client::new();
|
|
|
|
let srcset_value = "small.png 1x, large.png 2x";
|
2020-06-28 07:36:41 +02:00
|
|
|
let mut options = Options::default();
|
|
|
|
options.no_images = true;
|
|
|
|
options.silent = true;
|
2020-06-28 22:11:15 +02:00
|
|
|
let embedded_css = html::embed_srcset(cache, &client, "", &srcset_value, &options, 0);
|
2020-05-17 19:54:07 +02:00
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
format!("{} 1x, {} 2x", empty_image!(), empty_image!()),
|
|
|
|
embedded_css
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2020-12-26 01:24:52 +01:00
|
|
|
|
|
|
|
// ███████╗ █████╗ ██╗██╗ ██╗███╗ ██╗ ██████╗
|
|
|
|
// ██╔════╝██╔══██╗██║██║ ██║████╗ ██║██╔════╝
|
|
|
|
// █████╗ ███████║██║██║ ██║██╔██╗ ██║██║ ███╗
|
|
|
|
// ██╔══╝ ██╔══██║██║██║ ██║██║╚██╗██║██║ ██║
|
|
|
|
// ██║ ██║ ██║██║███████╗██║██║ ╚████║╚██████╔╝
|
|
|
|
// ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod failing {
|
|
|
|
use reqwest::blocking::Client;
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
use crate::html;
|
|
|
|
use crate::opts::Options;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn trailing_comma() {
|
|
|
|
let cache = &mut HashMap::new();
|
|
|
|
let client = Client::new();
|
|
|
|
let srcset_value = "small.png 1x, large.png 2x,";
|
|
|
|
let mut options = Options::default();
|
|
|
|
options.no_images = true;
|
|
|
|
options.silent = true;
|
|
|
|
let embedded_css = html::embed_srcset(cache, &client, "", &srcset_value, &options, 0);
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
format!("{} 1x, {} 2x", empty_image!(), empty_image!()),
|
|
|
|
embedded_css
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|