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

Function p2_cli_splice_stdin

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

Source from the content-addressed store, hash-verified

1204
1205 #[test]
1206 fn p2_cli_splice_stdin() -> Result<()> {
1207 let mut child = get_wasmtime_command()?
1208 .args(&["run", "-Wcomponent-model", P2_CLI_SPLICE_STDIN_COMPONENT])
1209 .stdout(Stdio::piped())
1210 .stderr(Stdio::piped())
1211 .stdin(Stdio::piped())
1212 .spawn()?;
1213 let msg = "So rested he by the Tumtum tree";
1214 child
1215 .stdin
1216 .take()
1217 .unwrap()
1218 .write_all(msg.as_bytes())
1219 .unwrap();
1220 let output = child.wait_with_output()?;
1221 assert!(output.status.success());
1222 let stdout = String::from_utf8_lossy(&output.stdout);
1223 let stderr = String::from_utf8_lossy(&output.stderr);
1224 if !stderr.is_empty() {
1225 eprintln!("{stderr}");
1226 }
1227
1228 assert_eq!(
1229 format!(
1230 "before splice\n{msg}\ncompleted splicing {} bytes\n",
1231 msg.as_bytes().len()
1232 ),
1233 stdout
1234 );
1235 Ok(())
1236 }
1237
1238 #[test]
1239 fn p2_cli_env() -> Result<()> {

Callers

nothing calls this directly

Calls 12

get_wasmtime_commandFunction · 0.85
OkFunction · 0.85
write_allMethod · 0.80
as_bytesMethod · 0.80
spawnMethod · 0.45
stdinMethod · 0.45
stderrMethod · 0.45
stdoutMethod · 0.45
argsMethod · 0.45
unwrapMethod · 0.45
takeMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected