diff --git a/tests/destination_parsing.rs b/tests/destination_parsing.rs index 7429585..a99741e 100644 --- a/tests/destination_parsing.rs +++ b/tests/destination_parsing.rs @@ -1,7 +1,6 @@ mod helpers; use firo_parser::parse_destination; -use helpers::file_to_string; #[test] fn valid_destination_file() { @@ -18,7 +17,7 @@ fn valid_destination_file() { ], vec![String::from(""), String::from(" /tmp/something.txt")], ]); - let unparsed = file_to_string("/home/yash/github/firo-parser/tests/destination.firo").unwrap(); + let unparsed = include_str!("destination.firo").to_string(); assert_eq!(destination, parse_destination(unparsed).unwrap()); } @@ -29,6 +28,6 @@ fn origin_is_valid_destination_file() { vec![String::from("plugin/file")], vec![String::from("folder/name with space.txt")], ]); - let unparsed = file_to_string("/home/yash/github/firo-parser/tests/origin.firo").unwrap(); + let unparsed = include_str!("origin.firo").to_string(); assert_eq!(destination, parse_destination(unparsed).unwrap().to_vec()); } diff --git a/tests/helpers.rs b/tests/helpers.rs deleted file mode 100644 index c1a6294..0000000 --- a/tests/helpers.rs +++ /dev/null @@ -1,6 +0,0 @@ -use anyhow::Result; -use std::fs; -pub fn file_to_string(path: &str) -> Result { - println!("Path: {:?}", path); - Ok(fs::read_to_string(path)?) -} diff --git a/tests/origin_parsing.rs b/tests/origin_parsing.rs index 6feeaea..26fcbbf 100644 --- a/tests/origin_parsing.rs +++ b/tests/origin_parsing.rs @@ -2,7 +2,6 @@ mod helpers; use std::collections::HashSet; use firo_parser::parse_origin; -use helpers::file_to_string; #[test] fn valid_origin_file() { @@ -11,11 +10,11 @@ fn valid_origin_file() { String::from("plugin/file"), String::from("folder/name with space.txt"), ]); - let unparsed = file_to_string("/home/yash/github/firo-parser/tests/origin.firo").unwrap(); + let unparsed = include_str!("origin.firo").to_string(); assert_eq!(origin, parse_origin(unparsed).unwrap()); } #[test] fn destination_is_invalid_origin_file() { - let unparsed = file_to_string("/home/yash/github/firo-parser/tests/destination.firo").unwrap(); + let unparsed = include_str!("destination.firo").to_string(); assert!(parse_origin(unparsed).is_err()); }