mirror of
https://github.com/narrrl/ytd-rs.git
synced 2026-11-03 16:41:27 +01:00
added test for basic functions
This commit is contained in:
1 parent
036447c2c4
commit
72e95d62a1
2 files changed
+24
-2
No files matched your search
@@ -9,3 +9,6 @@ homepape = "https://github.com/Nirusu99/ytd-rs"
|
||||
repository = "https://github.com/Nirusu99/ytd-rs"
|
||||
readme = "README.md"
|
||||
|
||||
|
||||
[dependencies]
|
||||
regex = "1"
|
||||
+21
-2
@@ -2,8 +2,27 @@ pub mod ytd;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use regex::Regex;
|
||||
use std::env;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
fn version() {
|
||||
let ytd = crate::ytd::YoutubeDL::new(
|
||||
env::current_dir()
|
||||
.expect("couldn't get working directory")
|
||||
.to_str()
|
||||
.unwrap(),
|
||||
// get youtube-dl version
|
||||
vec![crate::ytd::Arg::new("--version")],
|
||||
String::new(),
|
||||
)
|
||||
.expect("Couldn't create youtube-dl");
|
||||
|
||||
let regex = Regex::new(r"\d{4}\.\d{2}\.\d{2}").unwrap();
|
||||
let output = ytd.download();
|
||||
|
||||
// check output
|
||||
// fails if youtube-dl is not installed
|
||||
assert!(regex.is_match(output.output()));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user