Skip to content

Commit c215c42

Browse files
Fix deprecation warnings for regex in module attributes (#14387)
1 parent aca578b commit c215c42

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/elixir/test/elixir/access_test.exs

+7-6
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ defmodule AccessTest do
296296
describe "values/0" do
297297
@test_map %{a: 1, b: 2, c: 3, d: 4}
298298
@test_list [a: 1, b: 2, c: 3, d: 4]
299-
@error_msg_pattern ~r[^Access.values/0 expected a map or a keyword list, got: .*]
300299

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

337336
test "raises when not given a map or a keyword list" do
338-
assert_raise RuntimeError, @error_msg_pattern, fn ->
337+
message = ~r[^Access.values/0 expected a map or a keyword list, got: .*]
338+
339+
assert_raise RuntimeError, message, fn ->
339340
get_in(123, [Access.values()])
340341
end
341342

342-
assert_raise RuntimeError, @error_msg_pattern, fn ->
343+
assert_raise RuntimeError, message, fn ->
343344
get_and_update_in(:some_atom, [Access.values()], fn x -> {x, x} end)
344345
end
345346

346-
assert_raise RuntimeError, @error_msg_pattern, fn ->
347+
assert_raise RuntimeError, message, fn ->
347348
get_in([:a, :b, :c], [Access.values()])
348349
end
349350

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

354-
assert_raise RuntimeError, @error_msg_pattern, fn ->
355+
assert_raise RuntimeError, message, fn ->
355356
get_in([{1, 2}, {3, 4}], [Access.values()])
356357
end
357358
end

0 commit comments

Comments
 (0)