baml_language/crates/baml_tests/README.md
This crate contains all tests for the BAML compiler. Tests are automatically generated from BAML projects in the projects/ directory.
projects/:mkdir projects/my_test
echo "class Foo {}" > projects/my_test/main.baml
cargo test -p baml_tests my_test::
That's it! No test code to write.
The build script (build.rs) automatically:
projects/.baml files in each folder# Run all tests
cargo test -p baml_tests
# Run specific project tests
cargo test -p baml_tests simple_function::
# Update snapshots
cargo insta test --accept
# Review snapshots
cargo insta review
projects/
├── simple_function/ # Each folder is a test project
│ └── main.baml
├── complex_types/
│ ├── types.baml # Can have multiple files
│ └── functions.baml
└── nested/
└── models/ # Can have nested directories
└── user.baml
For each project, we automatically test:
All results are captured in snapshots for easy review.
This crate also includes comprehensive performance benchmarks. See BENCHMARKS.md for details.
# Run benchmarks
cargo bench --bench compiler_benchmark
# Run specific benchmark
cargo bench --bench compiler_benchmark bench_incremental_add_user_field