Skip to content

Commit

Permalink
Fix doctest on older Elixirs
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Jun 23, 2024
1 parent 57e5513 commit 5683de8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/nimble_ownership.ex
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,11 @@ defmodule NimbleOwnership do
iex> {:ok, server} = NimbleOwnership.start_link()
iex> {:ok, _} = NimbleOwnership.get_and_update(server, pid, :some_key, fn _ -> {nil, 1} end)
iex> :ok = NimbleOwnership.allow(server, pid, self(), :some_key)
iex> NimbleOwnership.get_and_update(server, self(), :some_key, fn current -> {current, 2} end)
{:error, %NimbleOwnership.Error{key: :some_key, reason: {:already_allowed, pid}}}
iex> {:error, error} = NimbleOwnership.get_and_update(server, self(), :some_key, fn current -> {current, 2} end)
iex> %NimbleOwnership.Error{} = error
iex> {:already_allowed, ^pid} = error.reason
iex> error.key
:some_key
"""
@spec get_and_update(server(), pid(), key(), fun, timeout()) ::
Expand Down

0 comments on commit 5683de8

Please sign in to comment.