mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-04-24 21:47:54 +00:00
Refactor/ignore null values (#135)
* Skip serialization of null values * Add support for comments in various steps
This commit is contained in:
@@ -36,20 +36,29 @@ pub enum Step {
|
||||
pub struct Input {
|
||||
#[serde(default = "Input::default_caller")]
|
||||
pub caller: Address,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub comment: Option<String>,
|
||||
#[serde(default = "Input::default_instance")]
|
||||
pub instance: ContractInstance,
|
||||
pub method: Method,
|
||||
#[serde(default)]
|
||||
pub calldata: Calldata,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub expected: Option<Expected>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub value: Option<EtherValue>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub storage: Option<HashMap<String, Calldata>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub variable_assignments: Option<VariableAssignments>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)]
|
||||
pub struct BalanceAssertion {
|
||||
/// An optional comment on the balance assertion.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub comment: Option<String>,
|
||||
|
||||
/// The address that the balance assertion should be done on.
|
||||
///
|
||||
/// This is a string which will be resolved into an address when being processed. Therefore,
|
||||
@@ -64,6 +73,10 @@ pub struct BalanceAssertion {
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)]
|
||||
pub struct StorageEmptyAssertion {
|
||||
/// An optional comment on the storage empty assertion.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub comment: Option<String>,
|
||||
|
||||
/// The address that the balance assertion should be done on.
|
||||
///
|
||||
/// This is a string which will be resolved into an address when being processed. Therefore,
|
||||
@@ -86,8 +99,11 @@ pub enum Expected {
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)]
|
||||
pub struct ExpectedOutput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub compiler_version: Option<VersionReq>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub return_data: Option<Calldata>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub events: Option<Vec<Event>>,
|
||||
#[serde(default)]
|
||||
pub exception: bool,
|
||||
@@ -95,6 +111,7 @@ pub struct ExpectedOutput {
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)]
|
||||
pub struct Event {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub address: Option<String>,
|
||||
pub topics: Vec<String>,
|
||||
pub values: Calldata,
|
||||
|
||||
Reference in New Issue
Block a user