sway icon indicating copy to clipboard operation
sway copied to clipboard

Attempt to include special code only available for cli_examples

Open crodas opened this issue 5 months ago • 1 comments

Description

The cli_examples are converted also to unit tests. These unit tests will compile a binary and execute it. The main goal is to enforce documentation correctness through the unit tests.

Sometimes a special case should be hard-coded (especially mocking user input) that should only be available for the binaries to be executed from the unit tests but should be excluded otherwise.

This PR adds the ability to include code through option_env! macro since the CLI_TEST should only be defined in for the binary to be executed from the unit tests.

This PR is a pre-requisite to solve https://github.com/FuelLabs/forc-wallet/issues/157.

This PR also fixes #5482

This PR will include more examples as part of #5444.

Checklist

  • [x] I have linked to any relevant issues.
  • [x] I have commented my code, particularly in hard-to-understand areas.
  • [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • [x] I have added tests that prove my fix is effective or that my feature works.
  • [x] I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • [x] I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • [x] I have requested a review from the relevant team or maintainers.

crodas avatar Jan 26 '24 06:01 crodas

@FuelLabs/tooling any idea how to generate a source map so I can test forc addr2line ?

crodas avatar Feb 01 '24 15:02 crodas