docs: Add docs for creating simulation tests (#6453)
This commit is contained in:
@ -19,6 +19,30 @@ We've built a lot of tooling to make contributing to KCL easier. If you are inte
|
||||
11. Run `just redo-kcl-stdlib-docs` to generate new Markdown documentation for your function that will be used [to generate docs on our website](https://zoo.dev/docs/kcl).
|
||||
12. Create a PR in GitHub.
|
||||
|
||||
## Making a Simulation Test
|
||||
|
||||
If you have KCL code that you want to test, simulation tests are the preferred way to do that.
|
||||
|
||||
Make a new sim test. Replace `foo_bar` with the snake case name of your test. The name needs to be unique.
|
||||
|
||||
```shell
|
||||
just new-sim-test foo_bar
|
||||
```
|
||||
|
||||
It will show the commands it ran, including the path to a new file `foo_bar/input.kcl`. Edit that with your KCL. If you need additional KCL files to import, include them in this directory.
|
||||
|
||||
Then run it.
|
||||
|
||||
```shell
|
||||
just overwrite-sim-test foo_bar
|
||||
```
|
||||
|
||||
The above should create a bunch of output files in the same directory.
|
||||
|
||||
Make sure you actually look at them. Specifically, if there's an `execution_error.snap`, it means the execution failed. Depending on the test, this may be what you expect. But if it's not, delete the snap file and run it again.
|
||||
|
||||
When it looks good, commit all the files, including `input.kcl`, generated output files in the test directory, and changes to `simulation_tests.rs`.
|
||||
|
||||
## Bumping the version
|
||||
|
||||
If you bump the version of kcl-lib and push it to crates, be sure to update the repos we own that use it as well. These are:
|
||||
|
Reference in New Issue
Block a user