---
title: "U3014: Host capability used in an example"
url: https://una-lang.org/en/docs/errors/U3014/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U3014.md
---

# U3014: Host capability used in an example

Examples, the tests written `test` from edition 0.3 and `example` in editions 0.1 and 0.2 (ADR 0105), are deterministic, so they never reach the host: every capability that the `do` line needs comes from a `given` line (`spec/08 §2` rule 1). U3014 reports a `do` line that needs a host capability (`Console`, `Clock`, `Env`, `Files` or `Keys`, from edition 0.2 also `Http`, and from edition 0.4 `HttpServer`, `spec/14 §3`) that no `given` line binds. User code may write a handler for a host capability and install it with `given`.

## The repair at a glance

```diff
  module demo

+ handler quiet() for Console
+   op print(line) = unit
+
  pub greet(name: Text) -> Unit
    uses @console: Console[print]
  =
    @console.print("hello {name}")

  example "a greeting"
+   given @console = quiet()
    do greet("Ana")
-   expect true
+   expect performed @console.print
```

## Failing example

```una
module demo

pub greet(name: Text) -> Unit
  uses @console: Console[print]
=
  @console.print("hello {name}")

example "a greeting"
  do greet("Ana")
  expect true
```

## Fixed example

```una
module demo

handler quiet() for Console
  op print(line) = unit

pub greet(name: Text) -> Unit
  uses @console: Console[print]
=
  @console.print("hello {name}")

example "a greeting"
  given @console = quiet()
  do greet("Ana")
  expect performed @console.print
```
