# `Calque`
[🔗](https://github.com/milaneuh/calque/blob/main/lib/calque.ex#L1)

Calque — a lightweight snapshot testing and review tool for Elixir projects.

Calque allows you to:
- **Record** test outputs as snapshot files (`*.snap`)
- **Compare** new outputs against previously accepted snapshots
- **Review and accept/reject** snapshots interactively from the CLI

## Typical usage

    Calque.check(result, "my test title")

If no accepted snapshot exists, Calque will create one and fail the test,
prompting you to review it with:

    mix calque review

Calque stores all snapshots under `calque_snapshots/` in your project root.

## CLI commands

- `mix calque review` — review new or changed snapshots interactively
- `mix calque accept-all` — accept all pending snapshots
- `mix calque reject-all` — reject all pending snapshots
- `mix calque clean` — delete pending, rejected, and unreferenced snapshots
- `mix calque help` — show CLI usage information

---

# `cli_command`
[🔗](https://github.com/milaneuh/calque/blob/main/lib/calque.ex#L690)

```elixir
@type cli_command() :: :review | :accept_all | :reject_all | :clean | :help
```

# `snapshot`
[🔗](https://github.com/milaneuh/calque/blob/main/lib/calque.ex#L34)

```elixir
@type snapshot() :: Calque.Snapshot.t()
```

# `check`
[🔗](https://github.com/milaneuh/calque/blob/main/lib/calque.ex#L112)
*macro* 

```elixir
@spec check(String.t()) :: :ok | no_return()
```

Performs a snapshot test using the **calling function name** as the snapshot title.

This macro is a convenience wrapper around `check/2`. The snapshot title is
automatically inferred from the surrounding function or test name, making it
the preferred API in most cases.

It behaves exactly like `check/2`: the content is compared against the accepted
snapshot, and the test fails if a new snapshot is created or a difference is
detected.

## Examples

Inside an ExUnit test:

    test "renders empty state" do
      html = render_empty_state()

      Calque.check(html)
    end

The snapshot title will automatically be set to:

    "renders empty state"

This keeps snapshot names stable and closely aligned with test intent, without
requiring any manual naming.

# `check`
[🔗](https://github.com/milaneuh/calque/blob/main/lib/calque.ex#L69)
*macro* 

```elixir
@spec check(String.t(), String.t()) :: :ok | no_return()
```

Performs a snapshot test with an explicit snapshot title.

This function writes the given content to a snapshot file (if none exists)
and compares it against the previously accepted snapshot.

In practice, you will usually prefer `check/1`, which automatically derives
the snapshot title from the calling test. Use `check/2` when you need full
control over the snapshot name.

## Examples

Using an explicit snapshot title:

    test "renders order confirmation" do
      html = render_confirmation(order)

      Calque.check(html, "order_confirmation")
    end

If the snapshot matches the accepted version, the test passes silently:

    :ok

If no snapshot exists yet, or if the content differs, the test fails and
prints a helpful diff.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
