@@ -20,6 +20,7 @@ defmodule Mix.Tasks.Compile.ProtocolsTest do
2020      """ ) 
2121
2222      assert  compile_elixir_and_protocols ( )  ==  :ok 
23+       assert  apply ( Compile.Protocol ,  :__protocol__ ,  [ :impls ] )  ==  { :consolidated ,  [ ] } 
2324      mark_as_old! ( "_build/dev/lib/sample/consolidated/Elixir.Compile.Protocol.beam" ) 
2425
2526      # Implement a local protocol 
@@ -30,20 +31,22 @@ defmodule Mix.Tasks.Compile.ProtocolsTest do
3031      """ ) 
3132
3233      assert  compile_elixir_and_protocols ( )  ==  :ok 
34+       assert  apply ( Compile.Protocol ,  :__protocol__ ,  [ :impls ] )  ==  { :consolidated ,  [ Integer ] } 
3335
3436      assert  mark_as_old! ( "_build/dev/lib/sample/consolidated/Elixir.Compile.Protocol.beam" )  != 
3537               @ old 
3638
3739      # Delete a local implementation 
3840      File . rm! ( "lib/impl.ex" ) 
3941      assert  compile_elixir_and_protocols ( )  ==  :ok 
42+       assert  apply ( Compile.Protocol ,  :__protocol__ ,  [ :impls ] )  ==  { :consolidated ,  [ ] } 
4043
4144      assert  mark_as_old! ( "_build/dev/lib/sample/consolidated/Elixir.Compile.Protocol.beam" )  != 
4245               @ old 
4346
4447      # Delete a local protocol 
4548      File . rm! ( "lib/protocol.ex" ) 
46-       assert  compile_elixir_and_protocols ( )  ==  :noop  
49+       assert  compile_elixir_and_protocols ( )  ==  :ok  
4750      refute  File . regular? ( "_build/dev/lib/sample/consolidated/Elixir.Compile.Protocol.beam" ) 
4851    end ) 
4952  end 
@@ -68,6 +71,7 @@ defmodule Mix.Tasks.Compile.ProtocolsTest do
6871      """ ) 
6972
7073      assert  compile_elixir_and_protocols ( )  ==  :ok 
74+       assert  apply ( Compile.Protocol ,  :__protocol__ ,  [ :impls ] )  ==  { :consolidated ,  [ Integer ] } 
7175      mark_as_old! ( "_build/dev/lib/sample/consolidated/Elixir.Compile.Protocol.beam" ) 
7276      File . rm! ( "lib/protocol.ex" ) 
7377
@@ -77,11 +81,13 @@ defmodule Mix.Tasks.Compile.ProtocolsTest do
7781      end 
7882      """ ) 
7983
80-       assert  compile_elixir_and_protocols ( )  ==  :noop 
84+       assert  compile_elixir_and_protocols ( )  ==  :ok 
85+       refute  function_exported? ( Compile.Protocol ,  :__protocol__ ,  1 ) 
8186
8287      # Delete a local protocol 
8388      File . rm! ( "lib/protocol.ex" ) 
84-       assert  compile_elixir_and_protocols ( )  ==  :noop 
89+       assert  compile_elixir_and_protocols ( )  ==  :ok 
90+       refute  function_exported? ( Compile.Protocol ,  :__protocol__ ,  1 ) 
8591      refute  File . regular? ( "_build/dev/lib/sample/consolidated/Elixir.Compile.Protocol.beam" ) 
8692    end ) 
8793  end 
@@ -95,12 +101,13 @@ defmodule Mix.Tasks.Compile.ProtocolsTest do
95101      purge_protocol ( String.Chars ) 
96102      mark_as_old! ( "_build/dev/lib/sample/consolidated/Elixir.String.Chars.beam" ) 
97103
98-       assert  compile_elixir_and_protocols ( )  ==  :noop 
104+       assert  compile_elixir_and_protocols ( )  ==  :ok 
105+       assert  { :consolidated ,  [ Atom  |  _ ] }  =  apply ( String.Chars ,  :__protocol__ ,  [ :impls ] ) 
99106      assert  mtime ( "_build/dev/lib/sample/consolidated/Elixir.String.Chars.beam" )  ==  @ old 
100107
101108      # Implement a deps protocol 
102109      File . write! ( "lib/struct.ex" ,  """ 
103-       defmodule Compile.Protocol.Struct  do 
110+       defmodule Aaaaa  do 
104111        defstruct a: nil 
105112        defimpl String.Chars do 
106113          def to_string(_), do: "ok" 
@@ -109,11 +116,13 @@ defmodule Mix.Tasks.Compile.ProtocolsTest do
109116      """ ) 
110117
111118      assert  compile_elixir_and_protocols ( )  ==  :ok 
119+       assert  { :consolidated ,  [ Aaaaa ,  Atom  |  _ ] }  =  apply ( String.Chars ,  :__protocol__ ,  [ :impls ] ) 
112120      assert  mark_as_old! ( "_build/dev/lib/sample/consolidated/Elixir.String.Chars.beam" )  !=  @ old 
113121
114122      # Delete the local implementation 
115123      File . rm! ( "lib/struct.ex" ) 
116124      assert  compile_elixir_and_protocols ( )  ==  :ok 
125+       assert  { :consolidated ,  [ Atom  |  _ ] }  =  apply ( String.Chars ,  :__protocol__ ,  [ :impls ] ) 
117126      assert  mark_as_old! ( "_build/dev/lib/sample/consolidated/Elixir.String.Chars.beam" )  !=  @ old 
118127    end ) 
119128  end 
@@ -143,8 +152,8 @@ defmodule Mix.Tasks.Compile.ProtocolsTest do
143152  end 
144153
145154  defp  compile_elixir_and_protocols  do 
146-     Mix.Tasks.Compile.Elixir  . run ( [ ] ) 
147-     Mix.Tasks.Compile.Protocols  . run ( [ ] ) 
155+     Mix.Tasks.Compile . reenable ( protocols:  :consolidate ) 
156+     with   { result ,   _ }   <-   Mix.Task  . run ( "compile" ) ,   do:  result 
148157  end 
149158
150159  defp  mtime ( path )  do 
0 commit comments