pulling the parse_file function to lib top

This commit is contained in:
Raamakrishnan 2020-01-31 22:56:26 +05:30
parent 73554ac998
commit 01d483331c
3 changed files with 3 additions and 7 deletions

View file

@ -1,9 +1,5 @@
pub mod file_parser;
pub mod line_parser;
pub use file_parser::parse_file;
pub use file_parser::Filelist;
use std::error::Error;
pub fn parse(path: &str) -> Result<Filelist, Box<dyn Error>> {
file_parser::parse_file(path)
}

View file

@ -6,6 +6,6 @@ use sv_filelist_parser;
fn main() {
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);
}

View file

@ -28,6 +28,6 @@ fn simple_test() {
std::env::set_var("VAR1", "ENV_VAR1");
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);
}