MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / p2_cli_serve_with_print_no_prefix

Function p2_cli_serve_with_print_no_prefix

tests/all/cli_tests.rs:2029–2076  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2027
2028 #[tokio::test]
2029 async fn p2_cli_serve_with_print_no_prefix() -> Result<()> {
2030 let server = WasmtimeServe::new(P2_CLI_SERVE_WITH_PRINT_COMPONENT, |cmd| {
2031 cmd.arg("-Scli");
2032 cmd.arg("--no-logging-prefix");
2033 })?;
2034
2035 for _ in 0..2 {
2036 let resp = server
2037 .send_request(
2038 hyper::Request::builder()
2039 .uri("http://localhost/")
2040 .body(String::new())
2041 .context("failed to make request")?,
2042 )
2043 .await?;
2044 assert!(resp.status().is_success());
2045 }
2046
2047 let (out, err) = server.finish()?;
2048 assert_eq!(
2049 out,
2050 "\
2051this is half a print to stdout
2052\n\
2053after empty
2054this is half a print to stdout
2055\n\
2056after empty
2057"
2058 );
2059 assert!(
2060 err.contains(
2061 "\
2062this is half a print to stderr
2063\n\
2064after empty
2065start a print 1234
2066this is half a print to stderr
2067\n\
2068after empty
2069start a print 1234
2070"
2071 ),
2072 "bad stderr {err}",
2073 );
2074
2075 Ok(())
2076 }
2077
2078 #[tokio::test]
2079 async fn p2_cli_serve_authority_and_scheme() -> Result<()> {

Callers

nothing calls this directly

Calls 8

OkFunction · 0.85
bodyMethod · 0.80
newFunction · 0.50
builderFunction · 0.50
argMethod · 0.45
send_requestMethod · 0.45
contextMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected