()
| 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<()> { |
nothing calls this directly
no test coverage detected