mirror of
https://github.com/supleed2/sv-filelist-parser.git
synced 2024-12-23 05:45:48 +00:00
pulling the parse_file function to lib top
This commit is contained in:
parent
73554ac998
commit
01d483331c
|
@ -1,9 +1,5 @@
|
||||||
pub mod file_parser;
|
pub mod file_parser;
|
||||||
pub mod line_parser;
|
pub mod line_parser;
|
||||||
|
|
||||||
|
pub use file_parser::parse_file;
|
||||||
pub use file_parser::Filelist;
|
pub use file_parser::Filelist;
|
||||||
use std::error::Error;
|
|
||||||
|
|
||||||
pub fn parse(path: &str) -> Result<Filelist, Box<dyn Error>> {
|
|
||||||
file_parser::parse_file(path)
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,6 +6,6 @@ use sv_filelist_parser;
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<String> = env::args().collect();
|
let args: Vec<String> = env::args().collect();
|
||||||
|
|
||||||
let filelist = sv_filelist_parser::parse(&args[1]).expect("Error parsing");
|
let filelist = sv_filelist_parser::parse_file(&args[1]).expect("Error parsing");
|
||||||
println!("{:#?}", filelist);
|
println!("{:#?}", filelist);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@ fn simple_test() {
|
||||||
std::env::set_var("VAR1", "ENV_VAR1");
|
std::env::set_var("VAR1", "ENV_VAR1");
|
||||||
std::env::set_var("VAR2", "ENV_VAR2");
|
std::env::set_var("VAR2", "ENV_VAR2");
|
||||||
|
|
||||||
let filelist = sv_filelist_parser::parse("testcase/files.f").expect("Error parsing");
|
let filelist = sv_filelist_parser::parse_file("testcase/files.f").expect("Error parsing");
|
||||||
assert_eq!(filelist_exp, filelist);
|
assert_eq!(filelist_exp, filelist);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue