refactoring and implementing clippy suggestions

This commit is contained in:
Schrottkatze 2023-11-18 19:56:08 +01:00
parent 3952091018
commit 2db2ef2ea1
5 changed files with 45 additions and 51 deletions

28
src/syntax/check/test.rs Normal file
View file

@ -0,0 +1,28 @@
use crate::syntax::{
check::{check_missing_filters, check_missing_sink, check_missing_streamer},
parse_syntax,
};
#[test]
fn test_check_missing_streamer() {
let test_data = "| invert | save \"./image_processed.jpg\"";
let syntax = parse_syntax(test_data).unwrap();
assert_eq!(check_missing_streamer(&syntax), Err(0..1))
}
#[test]
fn test_check_missing_filters() {
let test_data = "meow | | test | awa | | nya";
let syntax = parse_syntax(test_data).unwrap();
assert_eq!(check_missing_filters(&syntax), Err(vec![5..8, 20..25]))
}
#[test]
fn test_check_missing_sink() {
let test_data = "meow | invert | ";
let syntax = parse_syntax(test_data).unwrap();
assert_eq!(check_missing_sink(&syntax), Err(14..15))
}