Skip to content

Commit

Permalink
Update wasmcloud-test-util/src/lib.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Volosatovs <rvolosatovs@users.noreply.github.com>
  • Loading branch information
stevelr and rvolosatovs committed Feb 27, 2023
1 parent 8171ee4 commit 1536328
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions wasmcloud-test-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ pub mod testing {

// convert empty RpcResult into a testResult
impl<'name, T: Serialize> From<NamedResult<'name, T>> for TestResult {
fn from(name_res: NamedResult<'name, T>) -> TestResult {
let test_case_name = name_res.0.to_string();
let test_case_result = name_res.1;
match test_case_result {
fn from((name, res): NamedResult<'name, T>) -> TestResult {
let name = name.into();
match res {
Ok(res) => {
// test passed. Serialize the data to json
let data = match serde_json::to_vec(&res) {
Expand All @@ -46,7 +45,7 @@ pub mod testing {
Err(_) => b"".to_vec(),
};
TestResult {
name: test_case_name,
name,
passed: true,
snap_data: Some(data),
}
Expand All @@ -60,7 +59,7 @@ pub mod testing {
))
.ok();
TestResult {
name: test_case_name,
name,
passed: false,
snap_data: data,
}
Expand Down

0 comments on commit 1536328

Please sign in to comment.