Skip to content

Commit

Permalink
doc fixes for README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
qalisander committed Feb 7, 2025
1 parent 8962371 commit 3a4ccc8
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions crates/motsu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ Japanese -- we hold a stylus in our hand.
## Usage

This crate enables unit-testing for Stylus contracts. It abstracts away the
machinery necessary for writing tests behind a
[`#[motsu::test]`][test_attribute] procedural macro.
machinery necessary for writing tests behind a `#[motsu::test]` procedural macro.

Annotate tests with [`#[motsu::test]`][test_attribute] instead of `#[test]`
Annotate tests with `#[motsu::test]` instead of `#[test]`
to get access to VM affordances:

```rust
#[cfg(test)]
mod tests {
use motsu::prelude::*;
use stylus_sdk::alloy_primitives::{Address, U256};

#[motsu::test]
fn reads_balance(
Expand All @@ -42,9 +40,8 @@ pass additional value to the contract:

```rust
use motsu::prelude::*;
use stylus_sdk::alloy_primitives::{Address, U256, ruint::uint};

#[motsu_proc::test]
#[motsu::test]
fn pay_three_proxies(proxy: Contract<Proxy>, alice: Account) {
let one = uint!(1_U256);
let ten = uint!(10_U256);
Expand Down Expand Up @@ -72,9 +69,8 @@ chain of three `Proxy` contracts:

```rust
use motsu::prelude::*;
use stylus_sdk::alloy_primitives::{Address, U256, ruint::uint};

#[motsu_proc::test]
#[motsu::test]
fn call_three_proxies(
proxy1: Contract<Proxy>,
proxy2: Contract<Proxy>,
Expand All @@ -99,7 +95,7 @@ fn call_three_proxies(
```

Annotating a test function that accepts no parameters will make
[`#[motsu::test]`][test_attribute] behave the same as `#[test]`.
`#[motsu::test]` behave the same as `#[test]`.

```rust,ignore
#[cfg(test)]
Expand Down Expand Up @@ -142,12 +138,6 @@ NOTE!!!
For `motsu` to work correctly, `stylus-sdk` should **not** have
default `hostio-caching` feature enabled.

Following features: event log assertions, storage reset after erroneous transaction,
`proptest` affordances for `Contract` and `Account`
are not supported, and planed to be added soon.

[test_attribute]: crate::test

### Notice

We maintain this crate on a best-effort basis. We use it extensively on our own
Expand Down

0 comments on commit 3a4ccc8

Please sign in to comment.