mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
Merge pull request #4763 from roc-lang/tutorial_expect
This commit is contained in:
commit
871fa3bf3f
@ -105,7 +105,8 @@
|
||||
debugir
|
||||
rust
|
||||
rust-bindgen
|
||||
cargo-criterion
|
||||
cargo-criterion # for benchmarks
|
||||
simple-http-server # to view roc website when trying out edits
|
||||
]);
|
||||
in {
|
||||
|
||||
|
@ -23,6 +23,9 @@
|
||||
},
|
||||
{
|
||||
"pattern": "https://web.eecs.umich.edu"
|
||||
},
|
||||
{
|
||||
"pattern": "http://0.0.0.0:8000"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
# www.roc-lang.org
|
||||
|
||||
## How to update site
|
||||
|
||||
- create a new branch, for example `update-www` based on `www`
|
||||
- pull `main` into `update-www`
|
||||
- update for example the file `www/public/index.html`
|
||||
- do a PR against `www`
|
||||
- check deploy preview
|
||||
- review and merge
|
||||
To view the website after you've made a change, execute:
|
||||
```bash
|
||||
./www/build.sh
|
||||
cd www/build
|
||||
simple-http-server # If you're using the nix flake simple-http-server will already be installed. Withouth nix you can install it with `cargo install simple-http-server`.
|
||||
```
|
||||
Open http://0.0.0.0:8000 in your browser.
|
||||
|
@ -1195,6 +1195,16 @@ expect pluralize <span class="str">"cactus"</span> <span class="str">"cacti"</sp
|
||||
</samp>
|
||||
<p>If you put this in a file named <code>main.roc</code> and run <code>roc test</code>, Roc will execute the two <code>expect</code>
|
||||
expressions (that is, the two <code>pluralize</code> calls) and report any that returned <code>false</code>.</p>
|
||||
|
||||
<p>If a test fails, it will not show the actual value that differs from the expected value.
|
||||
To show the actual value, you can write the expect like this:</p>
|
||||
|
||||
<samp>expect
|
||||
funcOut <span class="op">=</span> pluralize <span class="str">"cactus"</span> <span class="str">"cacti"</span> 1
|
||||
|
||||
funcOut <span class="op">==</span> <span class="str">"2 cactus"</span>
|
||||
</samp>
|
||||
|
||||
<h3 id="inline-expects"><a href="#inline-expects">Inline Expectations</a></h3>
|
||||
<p>For example:</p>
|
||||
<samp> <span class="kw">if</span> count <span class="op">==</span> <span class="number">1</span> then
|
||||
|
Loading…
Reference in New Issue
Block a user