diff options
author | Yureka <tvl@yuka.dev> | 2024-10-01T14·17+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-10-01T15·36+0000 |
commit | 3606d7acc3300ec29d25e1c14c9450cf288195dd (patch) | |
tree | d9746c90ba47aa67469a4f7254831aaba7f9b1f8 | |
parent | ab3555f5a7fa6347049159ee3a32730f9a0c637c (diff) |
test(tvix/castore/refscan): add empty pattern regression test r/8748
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>
-rw-r--r-- | tvix/castore/src/refscan.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tvix/castore/src/refscan.rs b/tvix/castore/src/refscan.rs index 8e6a81b2a4fe..352593020472 100644 --- a/tvix/castore/src/refscan.rs +++ b/tvix/castore/src/refscan.rs @@ -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 } |