Skip to content

Developer docs#11

Open
TheRealOwenRees wants to merge 14 commits into
exercism:mainfrom
TheRealOwenRees:developer-docs
Open

Developer docs#11
TheRealOwenRees wants to merge 14 commits into
exercism:mainfrom
TheRealOwenRees:developer-docs

Conversation

@TheRealOwenRees

Copy link
Copy Markdown
Contributor

first draft of updating the repository's readme for contributing to the ReScript language track

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md
Now complete the following steps:

- `config.json` - ensure that the new exercise data is correctly placed in order of difficulty and then alphabetically within that difficulty rating.
- implement exercise test cases, detailed in the [testing](#testing) section below.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be clear here that they need to make a template file first for the test generator to run. They then need to run the generator, making sure it runs a compilable ReScriptTest suite. Tests may need to be excluded from the tests.toml as well so that should be done as well. However, test generator may need to be rerun after you start working on the example solution and find a test for make sense for ReScript. Therefore we should mention or link out about the toml and how to skip a test there.

Most of that is in the below section but it should be inlined here or introduced beforehand.

Perhaps we break this into task-related sections:

Generating Tests?

Do this...

Updating An Existing Exercise?

Do this...

Adding A New Exercise?

Do this...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest commit is draft 1 of this section. Please review. It is likely rough around the edges. I have commented out the old version for now, for reference.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the old version? Generally, it's old for a reason, and it's hard for me to skim through the file since I need to track regularly whether I'm in a commented-out section or not. The old versions if we need them are in the commit history.

@TheRealOwenRees TheRealOwenRees Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i will do that this evening, and start working on the suggestions

Comment thread README.md
Comment thread README.md
Comment thread README.md Outdated
@TheRealOwenRees TheRealOwenRees force-pushed the developer-docs branch 2 times, most recently from 9e3f019 to e2f1db1 Compare April 1, 2026 11:02
@TheRealOwenRees TheRealOwenRees requested a review from BNAndras June 4, 2026 08:08
@BNAndras

BNAndras commented Jun 7, 2026

Copy link
Copy Markdown
Member

I’ll take a look this weekend.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated

- **Configure the test template:** Edit `test_templates/<ExerciseName>_template.res`. Delete and uncomment the code where indicated. Use previous templates as examples of how to achieve what you need. Common comparator functions are found in `test_generator/Assertions.res`

- **Generate and run tests:** To build the test file and run it, run `make test EXERCISE=<exercise-slug>`. Your generated test cases are found in `exercises/<exercise-slug>/tests/<ExerciseName>_test.res`. Verify that the test cases accept and return the correct data.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Generate and run tests:** To build the test file and run it, run `make test EXERCISE=<exercise-slug>`. Your generated test cases are found in `exercises/<exercise-slug>/tests/<ExerciseName>_test.res`. Verify that the test cases accept and return the correct data.
- **Generate and run tests:** To build the test file and run it, run `make test EXERCISE=<exercise-slug>`. Your generated test cases are found in `exercises/practice/<exercise-slug>/tests/<ExerciseName>_test.res`. Verify that the test cases accept and return the correct data.

Comment thread README.md Outdated

- **Generate and run tests:** To build the test file and run it, run `make test EXERCISE=<exercise-slug>`. Your generated test cases are found in `exercises/<exercise-slug>/tests/<ExerciseName>_test.res`. Verify that the test cases accept and return the correct data.

- **Creating new comparator functions:** If none of the comparator functions satisfy the exercise's test requirements, you can write a new one in `test_generator/Assertions.res` and `test_generator/AssersionGenerators.res`, following the guidelines at https://bloodyowl.github.io/rescript-test/assertions. The function should be returned as a string, so that our templating system can inject the code into the generated tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Creating new comparator functions:** If none of the comparator functions satisfy the exercise's test requirements, you can write a new one in `test_generator/Assertions.res` and `test_generator/AssersionGenerators.res`, following the guidelines at https://bloodyowl.github.io/rescript-test/assertions. The function should be returned as a string, so that our templating system can inject the code into the generated tests.
- **Creating new comparator functions:** If none of the comparator functions satisfy the exercise's test requirements, you can write a new one in `test_generator/Assertions.res` and `test_generator/AssertionGenerators.res`, following the guidelines at https://bloodyowl.github.io/rescript-test/assertions. The function should be returned as a string, so that our templating system can inject the code into the generated tests.

Comment thread README.md

```shell
bin/add-practice-exercise -a foobar -d 3 <exercise-slug>
# auto format files

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configlet fmt -u prompts you on formatting the exercise. configlet fmt -uy would auto-confirm the prompt so that'd be the correct invocation for auto-formatting.

Comment thread README.md
## Adding exercises

New (practice) exercises can be added via:
Run the [`fmt` command][configlet-fmt-link] to verify if exercises and configuration files are formatted correctly. Address any issues before pushing your changes:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configlet fmt works specifically on config.json files, nothing else.

Comment thread README.md Outdated
make test EXERCISE=<exercise-slug>
```

Run all exercise's tests:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Run all exercise's tests:
Run all exercises' tests:

Comment thread README.md
- `exercises/practice/<exercise-slug>/.meta/tests.toml` - if any of these test cases are not relevant to the language, add `ignore = true` on a newline below the description
- `exercises/practice/<exercise-slug>/.meta/testTemplate.js` - edit this file to allow the test generator to automatically create test files.
- you must write your comparator functions - https://bloodyowl.github.io/rescript-test/assertions.
- common assertions with comparator functions are located at `test_generator/assertions.js`. Pass the required ones into the `assertionFunctions` array.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- common assertions with comparator functions are located at `test_generator/assertions.js`. Pass the required ones into the `assertionFunctions` array.
- common assertions with comparator functions are located at `test_generator/assertions.js`. Add the ones you'd like to use to the `assertionFunctions` array.

Comment thread README.md Outdated

Tests are written using [rescript-test](https://bloodyowl.github.io/rescript-test/). Follow these steps when writing tests:

- **Filter canonical data:** Open `exercises/practice/<exercise-slug>/.meta/tests.toml`. If a specific canonical test case is not applicable to ReScript, add ignore = true below its description. E.g.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Filter canonical data:** Open `exercises/practice/<exercise-slug>/.meta/tests.toml`. If a specific canonical test case is not applicable to ReScript, add ignore = true below its description. E.g.
- **Filter canonical data:** Open `exercises/practice/<exercise-slug>/.meta/tests.toml`. If a specific canonical test case is not applicable to ReScript, add include = false below its description. E.g.

@TheRealOwenRees

Copy link
Copy Markdown
Contributor Author

I am not certain how to ensure the problem specification is the newest version. Running git submodule update --init --recursive pulls the same version.

@BNAndras

BNAndras commented Jun 8, 2026

Copy link
Copy Markdown
Member

Hmm, I’m not sure to be honest so this will be a learning experience for me. I’ll take a look tonight or tomorrow.

@BNAndras

Copy link
Copy Markdown
Member

git submodule update --remote worked for me. We want to grab the latest commit from the submodule's remote which is the upstream problem-specifications repo. git submodule update --init --recursive grabs the commit this repo is pointing to, but that's stale so the CI fails.

@BNAndras

Copy link
Copy Markdown
Member

The CI isn't that terribly useful on PRs that don't interact with the problem-specifications submodule so I'll tweak the script so it only fires off in those situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants