<ContentPage
  eyebrow="Language"
  title="Testing"
  description='Write `test` blocks in Tea and run them with `tea test`. Assertions live in `std.assert`.'
>
  Tea tests live in ordinary Tea files. Define `test` blocks, import assertion helpers from `std.assert`, and run everything through `tea test`.

## Write a test block

A test block gives a named test case a small body of executable Tea code. Inside it, use assertion helpers to check expectations and fail fast when behavior changes.

```tea
use assert from "std.assert"

test "list length stays stable"
  var words = ["tea", "lang"]

  assert.ok(@len(words) == 2)
  assert.eq(words[0], "tea")
  assert.ne(words[1], "chai")
end
```

## Assertion helpers

The standard assertion module covers the common cases: truthy checks, equality checks, inequality checks, and snapshot helpers when you want to compare output against stored expectations.

```tea
use assert from "std.assert"

test "basic assertions"
  assert.ok(1 + 1 == 2)
  assert.eq("tea", "tea")
  assert.ne("tea", "chai")
end
```

## Run tests

Run the whole test suite or target a narrower path. The CLI can also list discovered tests or filter down to a subset when you only want to rerun one area.

```bash
tea test
tea test tests/
tea test --list
tea test --filter strings
tea test --update-snapshots
```

<KeyConceptCard title="Current test surface">
  <ul className="space-y-2">
    <li>`std.assert` exports `ok`, `eq`, `ne`, and `snapshot`.</li>
    <li>The CLI discovers Tea `test` blocks from paths you pass in.</li>
    <li>
      Snapshot support exists in the stdlib and CLI surface, but backend support
      is still uneven.
    </li>
  </ul>
</KeyConceptCard>

<div className="divider-section" />

  <NextSteps>
    <NextLink href="/reference/assert" title="std.assert" description="See the exact assertion helpers exported today." />
    <NextLink href="/docs/contributing" title="Contributing" description="Run the full repo test workflow." />
  </NextSteps>
</ContentPage>
