17 lines
1.2 KiB
Rust
17 lines
1.2 KiB
Rust
use m3u8download::make_url;
|
|
|
|
#[test]
|
|
fn test_make_url() {
|
|
assert_eq!("http://example.com/a/b.ts", &make_url("", "http://example.com/a/b.ts").unwrap());
|
|
assert_eq!("https://example.com/a/b.ts", &make_url("", "https://example.com/a/b.ts").unwrap());
|
|
assert_eq!("http://example.com/a/b.ts", &make_url("HTTP://example.com/x/y.m3u8", "//example.com/a/b.ts").unwrap());
|
|
assert_eq!("http://example.com/a/b.ts", &make_url("http://example.com/x/y.m3u8", "//example.com/a/b.ts").unwrap());
|
|
assert_eq!("https://example.com/a/b.ts", &make_url("HTTPS://example.com/x/y.m3u8", "//example.com/a/b.ts").unwrap());
|
|
assert_eq!("https://example.com/a/b.ts", &make_url("https://example.com/x/y.m3u8", "//example.com/a/b.ts").unwrap());
|
|
assert_eq!("https://example.com/a/b.ts", &make_url("https://example.com/x/y.m3u8", "/a/b.ts").unwrap());
|
|
assert_eq!("https://example.com/x/b.ts", &make_url("https://example.com/x/y.m3u8", "b.ts").unwrap());
|
|
assert_eq!("https://example.com/x/b.ts", &make_url("https://example.com/x/y", "b.ts").unwrap());
|
|
assert_eq!("https://example.com/x/y/b.ts", &make_url("https://example.com/x/y/", "b.ts").unwrap());
|
|
assert_eq!("https://example.com/x/y/a/b.ts", &make_url("https://example.com/x/y/", "a/b.ts").unwrap());
|
|
}
|