update .rules for new snapshot format

This commit is contained in:
Luke Boswell 2025-06-23 12:41:57 +10:00
parent c67630533f
commit 486842f655
No known key found for this signature in database
GPG key ID: 54A7324B1B975757

16
.rules
View file

@ -1,15 +1,18 @@
## Roc snapshot tool
The Roc compiler uses golden snapshots to assist with debugging and verification of the compiler's behavior. The snapshots are generated by running `zig build snapshot`, and individual files can be generated using `zig build snapshot -- <file_path>`. For example, to generate a snapshot for the file `src/snapshots/can_two_decls.txt`, run: `zig build snapshot -- src/snapshots/can_two_decls.txt`.
The Roc compiler uses golden snapshots to assist with debugging and verification of the compiler's behavior. The snapshots are generated by running `zig build snapshot`, and individual files can be generated using `zig build snapshot -- <file_path>`. For example, to generate a snapshot for the file `src/snapshots/can_two_decls.md`, run: `zig build snapshot -- src/snapshots/can_two_decls.md`.
Here is an example of a snapshot file for a roc program that prints `Hello world!`:
```txt
~~~META
# META
~~~ini
description=Hello world
type=file
~~~SOURCE
~~~
# SOURCE
~~~roc
app [main!] { pf: platform "../basic-cli/platform.roc" }
import pf.Stdout
@ -20,10 +23,13 @@ main! = |_| Stdout.line!("Hello, world!")
And another which represents a single expression of a list:
```txt
~~~META
# META
~~~ini
description=List with integer literals
type=expr
~~~SOURCE
~~~
# SOURCE
~~~roc
[1, 2, 3]
```