52 lines
2.4 KiB
Rust
52 lines
2.4 KiB
Rust
// ██████╗ █████╗ ███████╗███████╗██╗███╗ ██╗ ██████╗
|
|
// ██╔══██╗██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝
|
|
// ██████╔╝███████║███████╗███████╗██║██╔██╗ ██║██║ ███╗
|
|
// ██╔═══╝ ██╔══██║╚════██║╚════██║██║██║╚██╗██║██║ ██║
|
|
// ██║ ██║ ██║███████║███████║██║██║ ╚████║╚██████╔╝
|
|
// ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
|
|
#[cfg(test)]
|
|
mod passing {
|
|
use crate::url;
|
|
|
|
#[test]
|
|
fn data_url_text_html() {
|
|
assert!(url::is_data_url(
|
|
"data:text/html;base64,V2VsY29tZSBUbyBUaGUgUGFydHksIDxiPlBhbDwvYj4h"
|
|
));
|
|
}
|
|
|
|
#[test]
|
|
fn data_url_no_media_type() {
|
|
assert!(url::is_data_url(
|
|
"data:;base64,V2VsY29tZSBUbyBUaGUgUGFydHksIDxiPlBhbDwvYj4h"
|
|
));
|
|
}
|
|
}
|
|
|
|
// ███████╗ █████╗ ██╗██╗ ██╗███╗ ██╗ ██████╗
|
|
// ██╔════╝██╔══██╗██║██║ ██║████╗ ██║██╔════╝
|
|
// █████╗ ███████║██║██║ ██║██╔██╗ ██║██║ ███╗
|
|
// ██╔══╝ ██╔══██║██║██║ ██║██║╚██╗██║██║ ██║
|
|
// ██║ ██║ ██║██║███████╗██║██║ ╚████║╚██████╔╝
|
|
// ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
|
|
#[cfg(test)]
|
|
mod failing {
|
|
use crate::url;
|
|
|
|
#[test]
|
|
fn https_url() {
|
|
assert!(!url::is_data_url("https://kernel.org"));
|
|
}
|
|
|
|
#[test]
|
|
fn no_protocol_url() {
|
|
assert!(!url::is_data_url("//kernel.org"));
|
|
}
|
|
|
|
#[test]
|
|
fn empty_string() {
|
|
assert!(!url::is_data_url(""));
|
|
}
|
|
}
|