Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 1.98 KB

CONTRIBUTING.md

File metadata and controls

28 lines (18 loc) · 1.98 KB

Contributing to Oxiplate

Looking to use Oxiplate in your own project? Head on over to the readme instead. Otherwise, read on!

Initial setup

  1. Install Rust
  2. Fork this repository and clone it to your machine
  3. Run cargo test in the root directory of the project to download the dependencies and run the tests

General development

cargo dev will watch the files for changes and run various lint tools and tests automatically.

File organization

  • /docs/ is the source for https://0b10011.io/oxiplate/
  • /src/ is where Oxiplate code lives; this is what processes .oxip templates and generates Rust code from them
  • /target/ will be created when you build the project for the first time; this is where the binaries and intermediate build files live
  • /tests/ contains all of the tests to ensure Oxiplate continues to work as expected
  • /tests/broken/ contains tests specific to failures and the associated error messages
  • /tests/expansion/ verifies macro expansion for all base tests.

Testing

cargo test will run all but expansion tests. To include expansion tests, use cargo test -- --ignored. For more complicated failures, cargo expand --test if can be used to output the generated rust code for the if tests (replace if with the name of the test to expand).

There are three main categories of tests: features, failures, and expansions. Feature tests ensure the core features (e.g., if statements and whitespace control) work as expected. Failure tests use trybuild (via broken.rs) to ensure the error messages for broken builds are friendly to humans and actually help with debugging. And expansion tests use cargo expand (via expansion.rs) to verify feature test expansion is happening as expected.