Skip to content

Commit 7de811c

Browse files
committed
Fix warnings and races in tests
1 parent ff26a8f commit 7de811c

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

lib/elixir/lib/registry.ex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -757,28 +757,28 @@ defmodule Registry do
757757
In the example below we register the current process and look it up
758758
both from itself and other processes:
759759
760-
iex> Registry.start_link(keys: :unique, name: Registry.UniqueLookupTest)
761-
iex> Registry.values(Registry.UniqueLookupTest, "hello", self())
760+
iex> Registry.start_link(keys: :unique, name: Registry.UniqueValuesTest)
761+
iex> Registry.values(Registry.UniqueValuesTest, "hello", self())
762762
[]
763-
iex> {:ok, _} = Registry.register(Registry.UniqueLookupTest, "hello", :world)
764-
iex> Registry.values(Registry.UniqueLookupTest, "hello", self())
763+
iex> {:ok, _} = Registry.register(Registry.UniqueValuesTest, "hello", :world)
764+
iex> Registry.values(Registry.UniqueValuesTest, "hello", self())
765765
[:world]
766-
iex> Task.async(fn -> Registry.values(Registry.UniqueLookupTest, "hello", self()) end) |> Task.await()
766+
iex> Task.async(fn -> Registry.values(Registry.UniqueValuesTest, "hello", self()) end) |> Task.await()
767767
[]
768768
iex> parent = self()
769-
iex> Task.async(fn -> Registry.values(Registry.UniqueLookupTest, "hello", parent) end) |> Task.await()
769+
iex> Task.async(fn -> Registry.values(Registry.UniqueValuesTest, "hello", parent) end) |> Task.await()
770770
[:world]
771771
772772
The same applies to duplicate registries:
773773
774-
iex> Registry.start_link(keys: :duplicate, name: Registry.DuplicateLookupTest)
775-
iex> Registry.values(Registry.DuplicateLookupTest, "hello", self())
774+
iex> Registry.start_link(keys: :duplicate, name: Registry.DuplicateValuesTest)
775+
iex> Registry.values(Registry.DuplicateValuesTest, "hello", self())
776776
[]
777-
iex> {:ok, _} = Registry.register(Registry.DuplicateLookupTest, "hello", :world)
778-
iex> Registry.values(Registry.DuplicateLookupTest, "hello", self())
777+
iex> {:ok, _} = Registry.register(Registry.DuplicateValuesTest, "hello", :world)
778+
iex> Registry.values(Registry.DuplicateValuesTest, "hello", self())
779779
[:world]
780-
iex> {:ok, _} = Registry.register(Registry.DuplicateLookupTest, "hello", :another)
781-
iex> Enum.sort(Registry.values(Registry.DuplicateLookupTest, "hello", self()))
780+
iex> {:ok, _} = Registry.register(Registry.DuplicateValuesTest, "hello", :another)
781+
iex> Enum.sort(Registry.values(Registry.DuplicateValuesTest, "hello", self()))
782782
[:another, :world]
783783
784784
"""

lib/elixir/test/elixir/range_test.exs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ defmodule RangeTest do
3030

3131
test "new" do
3232
assert Range.new(1, 3) == 1..3//1
33-
assert Range.new(3, 1) == 3..1//-1
3433
assert Range.new(1, 3, 2) == 1..3//2
3534
assert Range.new(3, 1, -2) == 3..1//-2
35+
36+
assert ExUnit.CaptureIO.capture_io(:stderr, fn ->
37+
assert Range.new(3, 1) == 3..1//-1
38+
end) =~ "has a default step of -1"
3639
end
3740

3841
test "fields" do

0 commit comments

Comments
 (0)