Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain assert_macros in the guide #2531

Merged
merged 9 commits into from
Oct 1, 2024
24 changes: 24 additions & 0 deletions docs/src/getting-started/scarb.md
kkawula marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,27 @@ described [here](https://docs.swmansion.com/scarb/docs/extensions/testing.html#u

Last but not least, remember that in order to use Starknet Foundry, you must have Scarb
[installed](https://docs.swmansion.com/scarb/download.html) and added to the `PATH` environment variable.


### `assert_macros`
> ⚠️ **Recommended only for development** ️⚠️
>
>Assert macros package provides a set of macros that can be used to write assertions.
kkawula marked this conversation as resolved.
Show resolved Hide resolved
In order to use it, your project must have the `assert_macros` dependency added to the `Scarb.toml` file.
These macros are very expensive to run on Starknet, they generate a huge amount of steps and are not recommended for production use.
kkawula marked this conversation as resolved.
Show resolved Hide resolved
They are only meant to be used in tests.
kkawula marked this conversation as resolved.
Show resolved Hide resolved
For snforge `v0.31.0` and later, this dependency is added by default. But for earlier versions, you need to add it manually.

```toml
[dev-dependencies]
snforge_std = ...
assert_macros = "<scarb-version>"
```

Available assert macros are
- `assert_eq!`
- `assert_ne!`
- `assert_lt!`
- `assert_le!`
- `assert_gt!`
- `assert_ge!`
kkawula marked this conversation as resolved.
Show resolved Hide resolved
Loading