diff --git a/crates/syntest/README.md b/crates/syntest/README.md index 7598d8a..c47234c 100644 --- a/crates/syntest/README.md +++ b/crates/syntest/README.md @@ -1,5 +1,23 @@ # Syntest -Syntest is a simple Rust library with helper functions to help evaluate Rust code. +Syntest is a small crate that is used to test the rustfinity challenges not just by output and behavior but also by the syntax of the code. -It's used to evaluate user provided code snippets in the [rustfinity challenges](https://rustfinity.com/practice/rust/challenges) +## Usage + +```rust +use syntest::Syntest; + +#[test] +fn test_syntax() { + // opens the file and reads the code + let syntest = Syntest::from("./src/main.rs"); + + // gets all the local variables inside a function + let variables = syntest.variables("main"); + + // Checks if all of the variables are used + variables.iter().for_each(|variable| { + assert!(variable.is_used()); + }); +} +```