use crate::model::raw_file::RawFile;
#[macro_use]
mod macros;
pub mod ordered_serialization;
#[test]
fn test_empty_indexed_files() {
let raw_files = vec![];
assert_hashed_files!("empty_indexed_files", raw_files);
}
#[test]
fn test_indexed_file_with_no_lines() {
let raw_files = vec![RawFile {
filename: "raw_file_filename".to_string(),
lines: vec![],
}];
assert_hashed_files!("indexed_file_with_no_lines", raw_files);
}
#[test]
fn test_indexed_file_hashing_computed_correctly() {
let raw_files = vec![RawFile {
filename: "raw_file_filename".to_string(),
lines: vec![
"line 1".to_string(),
"line 2".to_string(),
"line 3".to_string(),
],
}];
assert_hashed_files!("indexed_file_hashing_computed_correctly", raw_files);
}
#[test]
fn test_indexed_file_with_ignore_line_regex() {
let raw_files = vec![RawFile {
filename: "raw_file_filename".to_string(),
lines: vec![
"line 1".to_string(),
"line 2".to_string(),
"line 3".to_string(),
],
}];
let ignore_line_regex = vec!["^line 1".to_string()];
assert_hashed_files_with_ignore_line_regex!(
"indexed_file_with_ignore_line_regex",
ignore_line_regex,
raw_files
);
}
#[test]
fn test_indexed_file_with_duplicate_lines() {
let raw_files = vec![RawFile {
filename: "raw_file_filename".to_string(),
lines: vec!["line".to_string(), "line".to_string(), "line ".to_string()],
}];
assert_hashed_files!("indexed_file_with_duplicate_lines", raw_files);
}