test(tvix/castore/refscan): add empty pattern regression test

Change-Id: I165261170edaabfc56f6ac0a6baae388332b3f73
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12559
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: yuka <yuka@yuka.dev>
This commit is contained in:
Yureka 2024-10-01 16:17:02 +02:00 committed by clbot
parent ab3555f5a7
commit 3606d7acc3

View file

@ -334,5 +334,21 @@ mod tests {
}
}
#[tokio::test]
async fn test_reference_reader_no_patterns() {
let pattern = ReferencePattern::new(Vec::<&str>::new());
let scanner = ReferenceScanner::new(pattern);
let mut mock = Builder::new();
mock.read(HELLO_DRV.as_bytes());
let mock = mock.build();
let mut reader = ReferenceReader::new(&scanner, mock);
let mut s = String::new();
reader.read_to_string(&mut s).await.unwrap();
assert_eq!(s, HELLO_DRV);
let result = scanner.finalise();
assert_eq!(result.len(), 0);
}
// FUTUREWORK: Test with large file
}