File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,29 @@ defmodule ProtocolTest do
8787 end
8888 end
8989
90+ test "built-in protocols" do
91+ builtin_protocols =
92+ for app <- ~w[ eex elixir ex_unit iex logger mix] a ,
93+ Application . ensure_loaded ( app ) ,
94+ module <- Application . spec ( app , :modules ) ,
95+ Code . ensure_loaded ( module ) ,
96+ function_exported? ( module , :__protocol__ , 1 ) ,
97+ do: module
98+
99+ # If this test fails, update:
100+ # * lib/elixir/lib/module/types/apply.ex
101+ # * lib/elixir/scripts/elixir_docs.ex
102+ assert Enum . sort ( builtin_protocols ) == [
103+ Collectable ,
104+ Enumerable ,
105+ IEx.Info ,
106+ Inspect ,
107+ JSON.Encoder ,
108+ List.Chars ,
109+ String.Chars
110+ ]
111+ end
112+
90113 test "protocol implementations without any" do
91114 assert is_nil ( Sample . impl_for ( :foo ) )
92115 assert is_nil ( Sample . impl_for ( fn x -> x end ) )
You can’t perform that action at this time.
0 commit comments