Skip to content

Commit

Permalink
Swap docs/TESTS.md with exercises/shared/.docs/tests.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ageron committed Aug 21, 2024
1 parent 46ecc1a commit b4617e4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
43 changes: 40 additions & 3 deletions docs/TESTS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Tests
# Testing on the Command Line

Roc comes with its own integrated test tools, no need to install anything else.
To download an exercise, for example `hello-world`, open a terminal and run:

To test your solution to an exercise, open a terminal, go to the exercise directory, run `roc test <exercise-name>-test.roc`, for example `roc test hello-world-test.roc`, and ensure that all the tests pass.
```bash
exercism download --track roc --exercise hello-world
```

Then go to the exercise directory and edit the code to solve the exercise. For example:

```bash
cd {your Exercism folder}/roc/hello-world
edit HelloWorld.roc
```

Each exercise comes with a test suite. You can run the tests using the `roc test` command, for example:

```
roc test hello-world-test.roc
```

If you've solved the exercise, you should see 0 failed test, for example:

```
0 failed and 1 passed in 583 ms.
```

However, if your code has any errors, they will look like this:

```
── EXPECT FAILED in hello-world-test.roc ───────────────────────────────────────
This expectation failed:
6│ expect hello == "Hello, World!"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 failed and 0 passed in 1264 ms.
```

This should help you fix your code. Once your code works, you can submit it using the `exercism submit` command (see `HELP.md` in the exercise directory for more details).
43 changes: 3 additions & 40 deletions exercises/shared/.docs/tests.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
# Testing on the Command Line
# Tests

To download an exercise, for example `hello-world`, open a terminal and run:
Roc comes with its own integrated test tools, no need to install anything else.

```bash
exercism download --track roc --exercise hello-world
```

Then go to the exercise directory and edit the code to solve the exercise. For example:

```bash
cd {your Exercism folder}/roc/hello-world
edit HelloWorld.roc
```

Each exercise comes with a test suite. You can run the tests using the `roc test` command, for example:

```
roc test hello-world-test.roc
```

If you've solved the exercise, you should see 0 failed test, for example:

```
0 failed and 1 passed in 583 ms.
```

However, if your code has any errors, they will look like this:

```
── EXPECT FAILED in hello-world-test.roc ───────────────────────────────────────
This expectation failed:
6│ expect hello == "Hello, World!"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 failed and 0 passed in 1264 ms.
```

This should help you fix your code. Once your code works, you can submit it using the `exercism submit` command (see `HELP.md` in the exercise directory for more details).
To test your solution to an exercise, open a terminal, go to the exercise directory, run `roc test <exercise-name>-test.roc`, for example `roc test hello-world-test.roc`, and ensure that all the tests pass.

0 comments on commit b4617e4

Please sign in to comment.