Skip to content

Conversation

@alexandrosfilios
Copy link
Contributor

@alexandrosfilios alexandrosfilios commented Oct 24, 2025

Description

All examples now test more stylus commands. Enabled the tuple example.

Checklist

  • I have documented these changes where necessary.
  • I have read the DCO and ensured that these changes comply.
  • I assign this work under its open source licensing.

@alexandrosfilios alexandrosfilios requested review from diegoximenes, gligneul and rory-ocl and removed request for gligneul October 24, 2025 13:32
@alexandrosfilios alexandrosfilios marked this pull request as ready for review October 24, 2025 13:34
use alloy::primitives::{Address, TxHash};
use eyre::Result;

pub trait ExampleContractTester {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the advantage of defining a trait for that?
How about moving those fn out of the trait, they don't rely on self, and change init to something like this?

pub fn init(expected_abi: String, expected_constructor: String) -> Result<(Node, Address)>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename this from init to something like init_and_test_all too.
Maybe there will be a future test scenario that we will only want to init, and do those other tests in the specific test implementation.

Copy link
Contributor Author

@alexandrosfilios alexandrosfilios Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason was because I wanted to override some methods, e.g. deployer(), but I can have both.


#[tokio::test]
async fn call() -> Result<()> {
let exporter = stylus_tools::Exporter::builder().build();
Copy link
Contributor

@diegoximenes diegoximenes Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that you didn't rely on stylus_tools::utils::testing::ExampleContractTester in this test, and other tests, since you want to confirm that this stylus_tools::utils::testing::ExampleContractTester strategy is better than replicating the code in every test, right?
I think not replicating is better in this case, so we can move forward with a strategy like stylus_tools::utils::testing::ExampleContractTester 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants