fix: quote tests
This commit is contained in:
parent
dcd1ef2eda
commit
e06fcd4fd3
|
@ -254,44 +254,30 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[rustfmt::skip]
|
|
||||||
fn expand_transfer_filter_with_alias() {
|
fn expand_transfer_filter_with_alias() {
|
||||||
let event = Event {
|
let event = Event {
|
||||||
name: "Transfer".into(),
|
name: "Transfer".into(),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
EventParam {
|
EventParam { name: "from".into(), kind: ParamType::Address, indexed: true },
|
||||||
name: "from".into(),
|
EventParam { name: "to".into(), kind: ParamType::Address, indexed: true },
|
||||||
kind: ParamType::Address,
|
EventParam { name: "amount".into(), kind: ParamType::Uint(256), indexed: false },
|
||||||
indexed: true,
|
|
||||||
},
|
|
||||||
EventParam {
|
|
||||||
name: "to".into(),
|
|
||||||
kind: ParamType::Address,
|
|
||||||
indexed: true,
|
|
||||||
},
|
|
||||||
EventParam {
|
|
||||||
name: "amount".into(),
|
|
||||||
kind: ParamType::Uint(256),
|
|
||||||
indexed: false,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
anonymous: false,
|
anonymous: false,
|
||||||
};
|
};
|
||||||
let sig = "Transfer(address,address,uint256)";
|
let sig = "Transfer(address,address,uint256)";
|
||||||
let cx = test_context_with_alias(sig, "TransferEvent");
|
let cx = test_context_with_alias(sig, "TransferEvent");
|
||||||
|
#[rustfmt::skip]
|
||||||
assert_quote!(cx.expand_filter(&event), {
|
assert_quote!(cx.expand_filter(&event), {
|
||||||
#[doc = "Gets the contract's `Transfer` event"]
|
#[doc = "Gets the contract's `Transfer` event"]
|
||||||
pub fn transfer_event_filter(
|
pub fn transfer_event_filter(
|
||||||
&self
|
&self
|
||||||
) -> ::ethers_contract::builders::Event<
|
) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, TransferEventFilter>
|
||||||
::std::sync::Arc<M>,
|
{
|
||||||
M,
|
|
||||||
TransferEventFilter,
|
|
||||||
> {
|
|
||||||
self.0.event()
|
self.0.event()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn expand_transfer_filter() {
|
fn expand_transfer_filter() {
|
||||||
let event = Event {
|
let event = Event {
|
||||||
|
@ -304,10 +290,11 @@ mod tests {
|
||||||
anonymous: false,
|
anonymous: false,
|
||||||
};
|
};
|
||||||
let cx = test_context();
|
let cx = test_context();
|
||||||
|
#[rustfmt::skip]
|
||||||
assert_quote!(cx.expand_filter(&event), {
|
assert_quote!(cx.expand_filter(&event), {
|
||||||
#[doc = "Gets the contract's `Transfer` event"]
|
#[doc = "Gets the contract's `Transfer` event"]
|
||||||
pub fn transfer_filter(
|
pub fn transfer_filter(
|
||||||
&self,
|
&self
|
||||||
) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, TransferFilter>
|
) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, TransferFilter>
|
||||||
{
|
{
|
||||||
self.0.event()
|
self.0.event()
|
||||||
|
@ -408,7 +395,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[rustfmt::skip]
|
|
||||||
fn expand_hash_value() {
|
fn expand_hash_value() {
|
||||||
assert_quote!(
|
assert_quote!(
|
||||||
expand_hash(
|
expand_hash(
|
||||||
|
@ -416,8 +402,8 @@ mod tests {
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
::ethers_core::types::H256([
|
::ethers_core::types::H256([
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
|
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
/// If the expanded source does not match the quoted source.
|
/// If the expanded source does not match the quoted source.
|
||||||
macro_rules! assert_quote {
|
macro_rules! assert_quote {
|
||||||
($ex:expr, { $($t:tt)* } $(,)?) => {
|
($ex:expr, { $($t:tt)* } $(,)?) => {
|
||||||
assert_eq!($ex.to_string(), quote::quote! { $($t)* }.to_string())
|
assert_eq!(
|
||||||
|
$ex.to_string(),
|
||||||
|
quote::quote! { $($t)* }.to_string(),
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue