Debian Codegraph @

testdata/highlight-middle-line.riff-output

raw
1 --- src/file.rs
2 +++ src/file.rs
3 @@ -442,9 +438,9 @@ mod tests {
4 println!("Evaluating example file <{}>...", diff.to_str().unwrap());
5
6 // Run highlighting on the file into a memory buffer
7 - let mut actual_result: Vec<u8> = Vec::new();
8 - highlight_diff(&mut fs::File::open(diff).unwrap(), &mut actual_result);
9 - let actual_result = str::from_utf8(&actual_result).unwrap();
10 + let file = tempfile::NamedTempFile::new().unwrap();
11 + highlight_diff(&mut fs::File::open(diff).unwrap(), file.reopen().unwrap());
12 + let actual_result = fs::read_to_string(file.path()).unwrap();
13
14 // Load the corresponding .riff-output file into a string
15 let basename = diff.file_stem().unwrap().to_str().unwrap();