Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings for regex in module attributes #14387

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/elixir/test/elixir/access_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ defmodule AccessTest do
describe "values/0" do
@test_map %{a: 1, b: 2, c: 3, d: 4}
@test_list [a: 1, b: 2, c: 3, d: 4]
@error_msg_pattern ~r[^Access.values/0 expected a map or a keyword list, got: .*]

test "retrieves values in a map" do
assert [1, 2, 3, 4] = get_in(@test_map, [Access.values()]) |> Enum.sort()
Expand Down Expand Up @@ -335,23 +334,25 @@ defmodule AccessTest do
end

test "raises when not given a map or a keyword list" do
assert_raise RuntimeError, @error_msg_pattern, fn ->
message = ~r[^Access.values/0 expected a map or a keyword list, got: .*]

assert_raise RuntimeError, message, fn ->
get_in(123, [Access.values()])
end

assert_raise RuntimeError, @error_msg_pattern, fn ->
assert_raise RuntimeError, message, fn ->
get_and_update_in(:some_atom, [Access.values()], fn x -> {x, x} end)
end

assert_raise RuntimeError, @error_msg_pattern, fn ->
assert_raise RuntimeError, message, fn ->
get_in([:a, :b, :c], [Access.values()])
end

assert_raise RuntimeError, @error_msg_pattern, fn ->
assert_raise RuntimeError, message, fn ->
get_in([{:a, :b, :c}, {:d, :e, :f}], [Access.values()])
end

assert_raise RuntimeError, @error_msg_pattern, fn ->
assert_raise RuntimeError, message, fn ->
get_in([{1, 2}, {3, 4}], [Access.values()])
end
end
Expand Down
Loading