Skip to content

Commit 85f74a5

Browse files
committed
Use to_json_string instead of to_json_vec for easier equality check
1 parent 3d42638 commit 85f74a5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/std/src/results/contract_result.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ use crate::prelude::*;
1717
/// Success:
1818
///
1919
/// ```
20-
/// # use cosmwasm_std::{to_json_vec, ContractResult, Response};
20+
/// # use cosmwasm_std::{to_json_string, ContractResult, Response};
2121
/// let response: Response = Response::default();
2222
/// let result: ContractResult<Response> = ContractResult::Ok(response);
23-
/// assert_eq!(to_json_vec(&result).unwrap(), br#"{"ok":{"messages":[],"attributes":[],"events":[],"data":null}}"#);
23+
/// assert_eq!(to_json_string(&result).unwrap(), r#"{"ok":{"messages":[],"attributes":[],"events":[],"data":null}}"#);
2424
/// ```
2525
///
2626
/// Failure:
2727
///
2828
/// ```
29-
/// # use cosmwasm_std::{to_json_vec, ContractResult, Response};
29+
/// # use cosmwasm_std::{to_json_string, ContractResult, Response};
3030
/// let error_msg = String::from("Something went wrong");
3131
/// let result: ContractResult<Response> = ContractResult::Err(error_msg);
32-
/// assert_eq!(to_json_vec(&result).unwrap(), br#"{"error":"Something went wrong"}"#);
32+
/// assert_eq!(to_json_string(&result).unwrap(), r#"{"error":"Something went wrong"}"#);
3333
/// ```
3434
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
3535
#[serde(rename_all = "snake_case")]

packages/std/src/results/system_result.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ use crate::SystemError;
1616
/// Success:
1717
///
1818
/// ```
19-
/// # use cosmwasm_std::{to_json_vec, Binary, ContractResult, SystemResult};
19+
/// # use cosmwasm_std::{to_json_string, Binary, ContractResult, SystemResult};
2020
/// let data = Binary::from(b"hello, world");
2121
/// let result = SystemResult::Ok(ContractResult::Ok(data));
22-
/// assert_eq!(to_json_vec(&result).unwrap(), br#"{"ok":{"ok":"aGVsbG8sIHdvcmxk"}}"#);
22+
/// assert_eq!(to_json_string(&result).unwrap(), r#"{"ok":{"ok":"aGVsbG8sIHdvcmxk"}}"#);
2323
/// ```
2424
///
2525
/// Failure:
2626
///
2727
/// ```
28-
/// # use cosmwasm_std::{to_json_vec, Binary, ContractResult, SystemResult, SystemError};
28+
/// # use cosmwasm_std::{to_json_string, Binary, ContractResult, SystemResult, SystemError};
2929
/// let error = SystemError::Unknown {};
3030
/// let result: SystemResult<Binary> = SystemResult::Err(error);
31-
/// assert_eq!(to_json_vec(&result).unwrap(), br#"{"error":{"unknown":{}}}"#);
31+
/// assert_eq!(to_json_string(&result).unwrap(), r#"{"error":{"unknown":{}}}"#);
3232
/// ```
3333
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
3434
#[serde(rename_all = "snake_case")]

0 commit comments

Comments
 (0)