MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_rewrite_with_line_ending

Function test_rewrite_with_line_ending

core/tests/testutils/mod.rs:472–486  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

470
471#[test]
472fn test_rewrite_with_line_ending() -> io::Result<()> {
473 let mut file = NamedTempFile::new()?;
474 write!(file, "Line 1\nLine 2\n")?;
475 file.flush()?;
476
477 rewrite_with_line_ending(file.path(), "\r\n")?;
478 let data = fs::read(file.path())?;
479 assert!(data.windows(2).any(|w| w == b"\r\n"));
480 for i in 0..data.len() {
481 if data[i] == b'\n' {
482 assert!(i > 0 && data[i - 1] == b'\r');
483 }
484 }
485 Ok(())
486}
487
488/// Executes `image` through completion in `vm`, and converts the result into an exit code.
489async fn run_image(vm: &mut Vm, image: &Image) -> Result<i32, String> {

Callers

nothing calls this directly

Calls 3

rewrite_with_line_endingFunction · 0.85
flushMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected