mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-17 05:21:06 +00:00
Wire up address replacement with rest of code
This commit is contained in:
@@ -365,23 +365,7 @@ where
|
|||||||
let _guard = span.enter();
|
let _guard = span.enter();
|
||||||
|
|
||||||
// Resolving the `input.expected` into a series of expectations that we can then assert on.
|
// Resolving the `input.expected` into a series of expectations that we can then assert on.
|
||||||
let expectations = match input {
|
let mut expectations = match input {
|
||||||
// This is a bit of a special case and we have to support it separately on it's own. If
|
|
||||||
// it's a call to the deployer method, then the tests will assert that it "returns" the
|
|
||||||
// address of the contract. Deployments do not return the address of the contract but
|
|
||||||
// the runtime code of the contracts. Therefore, this assertion would always fail. So,
|
|
||||||
// we replace it with an assertion of "check if it succeeded"
|
|
||||||
Input {
|
|
||||||
expected: Some(Expected::Calldata(Calldata::Compound(compound))),
|
|
||||||
method: Method::Deployer,
|
|
||||||
..
|
|
||||||
} if compound.len() == 1
|
|
||||||
&& compound
|
|
||||||
.first()
|
|
||||||
.is_some_and(|first| first.contains(".address")) =>
|
|
||||||
{
|
|
||||||
vec![ExpectedOutput::new().with_success()]
|
|
||||||
}
|
|
||||||
Input {
|
Input {
|
||||||
expected: Some(Expected::Calldata(calldata)),
|
expected: Some(Expected::Calldata(calldata)),
|
||||||
..
|
..
|
||||||
@@ -397,6 +381,17 @@ where
|
|||||||
Input { expected: None, .. } => vec![ExpectedOutput::new().with_success()],
|
Input { expected: None, .. } => vec![ExpectedOutput::new().with_success()],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This is a bit of a special case and we have to support it separately on it's own. If it's
|
||||||
|
// a call to the deployer method, then the tests will assert that it "returns" the address
|
||||||
|
// of the contract. Deployments do not return the address of the contract but the runtime
|
||||||
|
// code of the contracts. Therefore, this assertion would always fail. So, we replace it
|
||||||
|
// with an assertion of "check if it succeeded"
|
||||||
|
if let Method::Deployer = &input.method {
|
||||||
|
for expectation in expectations.iter_mut() {
|
||||||
|
expectation.return_data = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Note: we need to do assertions and checks on the output of the last call and this isn't
|
// Note: we need to do assertions and checks on the output of the last call and this isn't
|
||||||
// available in the receipt. The only way to get this information is through tracing on the
|
// available in the receipt. The only way to get this information is through tracing on the
|
||||||
// node.
|
// node.
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (corpus, tests) in collect_corpora(&args)? {
|
for (corpus, tests) in corpora {
|
||||||
let span = Span::new(corpus, args.clone())?;
|
let span = Span::new(corpus, args.clone())?;
|
||||||
|
|
||||||
match &args.compile_only {
|
match &args.compile_only {
|
||||||
|
|||||||
Reference in New Issue
Block a user