@@ -296,7 +296,6 @@ defmodule AccessTest do
296
296
describe "values/0" do
297
297
@ test_map % { a: 1 , b: 2 , c: 3 , d: 4 }
298
298
@ 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: .*]
300
299
301
300
test "retrieves values in a map" do
302
301
assert [ 1 , 2 , 3 , 4 ] = get_in ( @ test_map , [ Access . values ( ) ] ) |> Enum . sort ( )
@@ -335,23 +334,25 @@ defmodule AccessTest do
335
334
end
336
335
337
336
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 ->
339
340
get_in ( 123 , [ Access . values ( ) ] )
340
341
end
341
342
342
- assert_raise RuntimeError , @ error_msg_pattern , fn ->
343
+ assert_raise RuntimeError , message , fn ->
343
344
get_and_update_in ( :some_atom , [ Access . values ( ) ] , fn x -> { x , x } end )
344
345
end
345
346
346
- assert_raise RuntimeError , @ error_msg_pattern , fn ->
347
+ assert_raise RuntimeError , message , fn ->
347
348
get_in ( [ :a , :b , :c ] , [ Access . values ( ) ] )
348
349
end
349
350
350
- assert_raise RuntimeError , @ error_msg_pattern , fn ->
351
+ assert_raise RuntimeError , message , fn ->
351
352
get_in ( [ { :a , :b , :c } , { :d , :e , :f } ] , [ Access . values ( ) ] )
352
353
end
353
354
354
- assert_raise RuntimeError , @ error_msg_pattern , fn ->
355
+ assert_raise RuntimeError , message , fn ->
355
356
get_in ( [ { 1 , 2 } , { 3 , 4 } ] , [ Access . values ( ) ] )
356
357
end
357
358
end
0 commit comments