# `Kinda.Testing.NIFUpgrade`
[🔗](https://github.com/beaver-lodge/kinda/blob/main/lib/kinda/testing/nif_upgrade.ex#L1)

Test support for loading a second copy of a NIF into an existing module.

The copied library keeps the same native entry name; the distinct path only
gives the dynamic loader a second image to pass through the NIF `upgrade`
callback. Use the separate `kinda_sandbox` package when the entry name itself
must differ.

# `snapshot`

```elixir
@type snapshot() :: %Kinda.Testing.NIFUpgrade.Snapshot{
  binary: binary(),
  module: module(),
  path: charlist()
}
```

# `copy_library!`

```elixir
@spec copy_library!(atom(), String.t(), Path.t(), keyword()) :: Path.t()
```

# `load!`

```elixir
@spec load!(module(), Path.t()) :: {:module, module(), binary(), term()}
```

# `remember!`

```elixir
@spec remember!(module()) :: snapshot()
```

# `restore!`

```elixir
@spec restore!(snapshot()) :: :ok
```

# `run!`

```elixir
@spec run!(module(), atom(), String.t(), Path.t(), (-&gt; result)) :: result
when result: term()
```

---

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