@@ -160,21 +160,6 @@ defmodule ProtocolTest do
160160 assert WithAny . __info__ ( :attributes ) [ :protocol ] == [ fallback_to_any: true ]
161161 end
162162
163- test "protocols always keep debug_info" do
164- Code . compiler_options ( debug_info: false )
165-
166- { :module , _ , binary , _ } =
167- defprotocol DebugInfoProto do
168- end
169-
170- assert { :ok , { DebugInfoProto , [ debug_info: debug_info ] } } =
171- :beam_lib . chunks ( binary , [ :debug_info ] )
172-
173- assert { :debug_info_v1 , :elixir_erl , { :elixir_v1 , _ , _ } } = debug_info
174- after
175- Code . compiler_options ( debug_info: true )
176- end
177-
178163 test "defimpl" do
179164 module = Module . concat ( Sample , ImplStruct )
180165 assert module . __impl__ ( :for ) == ImplStruct
@@ -275,6 +260,25 @@ defmodule ProtocolTest do
275260 end
276261end
277262
263+ defmodule Protocol.DebugInfoTest do
264+ use ExUnit.Case
265+
266+ test "protocols always keep debug_info" do
267+ Code . compiler_options ( debug_info: false )
268+
269+ { :module , _ , binary , _ } =
270+ defprotocol DebugInfoProto do
271+ end
272+
273+ assert { :ok , { DebugInfoProto , [ debug_info: debug_info ] } } =
274+ :beam_lib . chunks ( binary , [ :debug_info ] )
275+
276+ assert { :debug_info_v1 , :elixir_erl , { :elixir_v1 , _ , _ } } = debug_info
277+ after
278+ Code . compiler_options ( debug_info: true )
279+ end
280+ end
281+
278282path = Path . expand ( "../ebin" , __DIR__ )
279283File . mkdir_p! ( path )
280284
0 commit comments