File tree Expand file tree Collapse file tree 1 file changed +22
-20
lines changed
lib/elixir/test/elixir/kernel Expand file tree Collapse file tree 1 file changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -304,32 +304,34 @@ defmodule Kernel.RaiseTest do
304304 assert result == "no match of right hand side value: 0"
305305 end
306306
307- test :bad_key_error do
308- result = try do
309- % { % { } | foo: :bar }
310- rescue
311- x in [ KeyError ] -> Exception . message ( x )
312- end
307+ if :erlang . system_info ( :otp_release ) >= '18' do
308+ test :bad_key_error do
309+ result = try do
310+ % { % { } | foo: :bar }
311+ rescue
312+ x in [ KeyError ] -> Exception . message ( x )
313+ end
313314
314- assert result == "key :foo not found"
315+ assert result == "key :foo not found"
315316
316- result = try do
317- % { } . foo
318- rescue
319- x in [ KeyError ] -> Exception . message ( x )
317+ result = try do
318+ % { } . foo
319+ rescue
320+ x in [ KeyError ] -> Exception . message ( x )
321+ end
322+
323+ assert result == "key :foo not found in: %{}"
320324 end
321325
322- assert result == "key :foo not found in: %{}"
323- end
326+ test :bad_map_error do
327+ result = try do
328+ % { zero ( 0 ) | foo: :bar }
329+ rescue
330+ x in [ BadMapError ] -> Exception . message ( x )
331+ end
324332
325- test :bad_map_error do
326- result = try do
327- % { zero ( 0 ) | foo: :bar }
328- rescue
329- x in [ BadMapError ] -> Exception . message ( x )
333+ assert result == "expected a map, got: 0"
330334 end
331-
332- assert result == "expected a map, got: 0"
333335 end
334336
335337 test :case_clause_error do
You can’t perform that action at this time.
0 commit comments