Skip to content

Commit

Permalink
Merge branch 'main' into tooling-best-practices
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom authored Aug 7, 2024
2 parents 122b377 + 3d692cf commit 8466bb9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
7 changes: 7 additions & 0 deletions building/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,13 @@
"title": "The Test Runner Interface",
"blurb": ""
},
{
"uuid": "0ab39b58-771e-42dc-aac9-e531bf43034e",
"slug": "tooling/test-runners/libraries",
"path": "building/tooling/test-runners/libraries.md",
"title": "Libraries",
"blurb": ""
},
{
"uuid": "a9cf4712-9022-4bd2-83aa-55cbdfd62374",
"slug": "tooling/lines-of-code-counter",
Expand Down
1 change: 1 addition & 0 deletions building/tooling/test-runners/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ You can use the following documents to learn more about building a test runner:
- [The Test Runner interface](/docs/building/tooling/test-runners/interface)
- [How to build a Docker image with Docker for local testing and deployment](/docs/building/tooling/test-runners/docker)
- [Best practices](/docs/building/tooling/best-practices)
- [When and how to support libraries](/docs/building/tooling/test-runners/libraries)
33 changes: 33 additions & 0 deletions building/tooling/test-runners/libraries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Libraries

Exercism aims to teach [fluency](/docs/using/product/fluency) in the syntax, idioms, and the standard library of the language.
This explicitly does _not_ mention external (non built-in) libraries, as that falls under _proficiency_.
Exercises must thus, with few exceptions, be solvable without using libraries.

## Reasons to support libraries

There are couple of reasons why a track might still want to support libraries:

1. The language has a (very) minimal standard library.
An example of such a language is Rust.
2. The library adds testing functionality.
An example is a library that adds support for property-based testing.
3. The exercise can only be solved using a library.
An example of such an exercise is the [lens-person exercise](https://exercism.org/exercises/lens-person), which in most languages can only be solved using a library.

## Supporting libraries in the test runner

As the test runner does not have access to the internet whilst running, it is not possible to download libraries at run time.
The **only** solution to this problem is to install/download libraries at build time, where you _do_ have access to the internet.
In practice, this means you'll need to install/download libraries within the Dockerfile.

As an example, the [Prolog test runner's Dockerfile](https://github.com/exercism/prolog-test-runner/blob/ed7447a7518ede6ee3405e649f50aaec828e318b/Dockerfile) installs the `date_time` library:

```dockerfile
RUN swipl pack install date_time -y
```

## Documentation

If your track supports libraries, this should be documented in a [track doc](/docs/building/tracks/docs).
Please also link to this document (using its full URL) from the [`exercises/shared/.docs/help.md` document](/docs/building/tracks/shared-files#file-help-md).

0 comments on commit 8466bb9

Please sign in to comment.