From 01d483331c0393f4928188027a72a91f6ad0c128 Mon Sep 17 00:00:00 2001 From: Raamakrishnan Date: Fri, 31 Jan 2020 22:56:26 +0530 Subject: [PATCH] pulling the parse_file function to lib top --- src/lib.rs | 6 +----- src/main.rs | 2 +- tests/integration_tests.rs | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c312e7a..6e06f64 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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> { - file_parser::parse_file(path) -} diff --git a/src/main.rs b/src/main.rs index c8d419c..559fcf8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,6 @@ use sv_filelist_parser; fn main() { let args: Vec = 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); } diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index f9f9ea6..7059339 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -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); }