Initial Dever 0.0.1

This commit is contained in:
Codex committed 2026-11-03 03:32:07 +00:00
commit 81233d098c
1479 files changed
+163782

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
use super::*;
use std::{
process::Command,
time::{Duration, Instant},
};
#[test]
fn native_http_open_stream_upload_early_close_and_cancel() {
let directory = Directory::new();
let project = Project::load(&fixture().with_file_name("http-stream.dever")).unwrap();
let program = project.check().unwrap();
let binary = build::build(
&program,
&project.sources,
"verify",
&directory.0.join("http-stream"),
)
.unwrap();
let output_path = directory.0.join("stdout");
let error_path = directory.0.join("stderr");
let mut child = Command::new(binary)
.stdout(std::fs::File::create(&output_path).unwrap())
.stderr(std::fs::File::create(&error_path).unwrap())
.spawn()
.unwrap();
let start = Instant::now();
let status = loop {
if let Some(status) = child.try_wait().unwrap() {
break status;
}
if start.elapsed() > Duration::from_secs(20) {
child.kill().unwrap();
child.wait().unwrap();
panic!(
"streaming native test timed out: {}",
std::fs::read_to_string(&error_path).unwrap()
);
}
std::thread::sleep(Duration::from_millis(10));
};
assert!(
status.success(),
"{}",
std::fs::read_to_string(&error_path).unwrap()
);
assert_eq!(std::fs::read(output_path).unwrap(), b"true\n");
}