---
title: "una test"
url: https://una-lang.org/en/docs/cli/test/
release: v0.4.0
---

# una test

Run every test (`example` in editions 0.1 and 0.2).

```text
una test [OPTIONS] [PATH]
```

## Examples

```sh
una test .
```

Run every test of the package.

```sh
una --json test .
```

The outcomes as one JSON document.

## Arguments

| Argument | What it does | Default |
| --- | --- | --- |
| `[PATH]` | The package directory, or a single file | `.` |

## Options

| Option | What it does | Default |
| --- | --- | --- |
| `--json` | Print machine output as JSON on stdout, and nothing else on stdout |  |
| `--max-depth <N>` | The maximum call depth | `10000` |
| `--color <WHEN>` | When to use colors in human output. Values: `never`: Never use colors; `auto`: Use colors when the output is a terminal; `always`: Always use colors. | `auto` |
| `--max-memory <MIB>` | The memory a run may hold, in MiB: 4096 by default, or the package's declared max_memory, which it may lower and never raise |  |
| `--workers <N>` | The threads that run tasks, from 1 to 1024; by default one per core |  |
| `--task-depth <N>` | The depth limit of the tasks of `first of` and `start`, from 1 to --max-depth; by default 1000 |  |
| `--io-threads <N>` | The helper threads of `Http`, from 1 to 4096; by default 64. A run granted `Http` starts 2 x N + max(2, N / 4) threads for its requests before `main`, besides --workers and --file-threads, so a large N can pass the system's limit on a process's threads, and the run then stops with U6003 |  |
| `--file-threads <N>` | The helper threads of `Files` and `Console`, from 1 to 256; by default 4 |  |
| `--solver-wallclock <SECONDS>` | Stop a solver query after this many seconds; the obligation is then unknown | `60` |
| `--solver-memory <MIB>` | The memory limit of each solver query in MiB, from 256 to 1048576 | `4096` |

## Specification

The normative rules, from spec/13 §5:

| Command | Meaning |
| --- | --- |
| `una test [path]` | Run all tests (`example` declarations in editions `0.1` and `0.2`) |

`una test [path]` prints, in human mode, one line per example on stdout, `example <module> "<name>" ... ok` or `... FAILED`, followed for a failed example by the file, line and text of the expectation to blame, when there is one, and the reason; then a blank line and `<n> examples: <p> passed, <f> failed`. It exits with code 1 when an example fails. With `--json` it prints `{"schema":"una.test/1","tier":...,"diagnostics":[...],"examples":[...],"passed":p,"failed":f}`: `diagnostics` holds the errors of the checks when nothing ran, or U6003 and U8001 of aborted examples; each example has `module`, `name`, `outcome` (`pass` or `fail`), `reason` (`null`, or why it fails), `expectation` (`null`, or `{"file":...,"line":...,"text":...}`), `result` (`{"kind":"ok","value":...}`, `{"kind":"fail","variant":...,"value":...}` or `{"kind":"aborted"}`) and `trace` (`spec/11 §5`). (v0.2, ADR 0078.) The document also holds `redacted`, after `tier`: `true` when the results and reasons of its examples redact labeled fields, as in a package of edition `0.1`, and `false` when they show every field, as in a package of edition `0.2` (`spec/11 §5`). The key is additive, and the schema stays `una.test/1`. (v0.3, ADR 0105.) For a package of edition `0.3` or later, where the declaration is written `test`, each line reads `test <module> "<name>" ... ok` or `... FAILED` and the summary `<n> tests: <p> passed, <f> failed`, and `--json` prints `{"schema":"una.test/2","tier":...,"redacted":...,"diagnostics":[...],"tests":[...],"passed":p,"failed":f}`, the schema `una.test/2`: the document of `una.test/1` with the key `examples` renamed `tests`, holding the same objects in the same order with the same keys. Packages of editions `0.1` and `0.2` keep `una.test/1` byte for byte. A consumer that reads both dispatches on `schema`.


## Help text

As `una test --help` prints it at v0.4.0:

```text
Run every test (`example` in editions 0.1 and 0.2)

Usage: una test [OPTIONS] [PATH]

Arguments:
  [PATH]
          The package directory, or a single file

          [default: .]

Options:
      --json
          Print machine output as JSON on stdout, and nothing else on stdout

      --max-depth <N>
          The maximum call depth

          [default: 10000]

      --color <WHEN>
          When to use colors in human output

          Possible values:
          - never:  Never use colors
          - auto:   Use colors when the output is a terminal
          - always: Always use colors

          [default: auto]

      --max-memory <MIB>
          The memory a run may hold, in MiB: 4096 by default, or the package's declared max_memory, which it may lower and never raise

      --workers <N>
          The threads that run tasks, from 1 to 1024; by default one per core (ADR 0117)

      --task-depth <N>
          The depth limit of the tasks of `first of` and `start`, from 1 to --max-depth; by default 1000 (ADR 0117)

      --io-threads <N>
          The helper threads of `Http`, from 1 to 4096; by default 64 (ADR 0117). A run granted `Http` starts 2 x N + max(2, N / 4) threads for its requests before `main`, besides --workers and --file-threads, so a large N can pass the system's limit on a process's threads, and the run then stops with U6003

      --file-threads <N>
          The helper threads of `Files` and `Console`, from 1 to 256; by default 4 (ADR 0117)

      --solver-wallclock <SECONDS>
          Stop a solver query after this many seconds; the obligation is then unknown

          [default: 60]

      --solver-memory <MIB>
          The memory limit of each solver query in MiB, from 256 to 1048576 (ADR 0124)

          [default: 4096]

  -h, --help
          Print help (see a summary with '-h')
```
