diff options
author | Lizzy Fleckenstein <eliasfleckenstein@web.de> | 2023-02-12 20:09:54 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <eliasfleckenstein@web.de> | 2023-02-12 20:09:59 +0100 |
commit | 50d2e34e7148fef9e67428f8a533d37aab07bee9 (patch) | |
tree | dc5c1c6a570d2719945dd0f02674701ee06a980e /tests/random.rs | |
parent | 1e8b8168f14787284a14b1d29d7b4b8fcd897142 (diff) | |
download | mt_net-50d2e34e7148fef9e67428f8a533d37aab07bee9.tar.xz |
Fix reserialize exiting before finished
Diffstat (limited to 'tests/random.rs')
-rw-r--r-- | tests/random.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/random.rs b/tests/random.rs index d92ce79..e3b387a 100644 --- a/tests/random.rs +++ b/tests/random.rs @@ -29,9 +29,9 @@ where let input = T::generate_random_variant(&mut rng, i); - let mut writer = Vec::new(); + let mut input_payload = Vec::new(); input - .mt_serialize::<DefCfg>(&mut writer) + .mt_serialize::<DefCfg>(&mut input_payload) .map_err(|e| format!("serialize error: {e}\ninput: {input:?}"))?; let mut child = Command::new(&reserialize) @@ -42,13 +42,13 @@ where .spawn() .expect("failed to spawn reserialize"); - let mut stdin = child.stdin.take().expect("failed to open stdin"); - let payload = writer.clone(); + let mut stdin = child.stdin.take().unwrap(); + let stdin_payload = input_payload.clone(); std::thread::spawn(move || { - stdin.write_all(&payload).expect("failed to write to stdin"); + stdin.write_all(&stdin_payload).unwrap(); }); - let command_out = child.wait_with_output().expect("failed to read stdout"); + let command_out = child.wait_with_output().unwrap(); let stderr = String::from_utf8_lossy(&command_out.stderr); if command_out.status.success() { @@ -60,7 +60,7 @@ where return Err(format!( "reserialize returned failure\n\ input: {input:?}\n\ - input payload: {writer:?}\n\ + input payload: {input_payload:?}\n\ stderr: {stderr}" ) .into()); @@ -71,7 +71,7 @@ where format!( "deserialize error: {e}\n\ input: {input:?}\n\ - input payload: {writer:?}\n\ + input payload: {input_payload:?}\n\ output payload: {:?}\n\ stderr: {stderr}", reader.get_ref() @@ -83,7 +83,7 @@ where "output does not match input\n\ input: {input:?}\n\ output: {output:?}\n\ - input payload: {writer:?}\n\ + input payload: {input_payload:?}\n\ output payload: {:?}\n\ stderr: {stderr}", reader.get_ref(), |