@@ -39,53 +39,53 @@ defmodule IEx.HelpersTest do
3939 end
4040
4141 test "sets up a breakpoint with capture syntax" do
42- assert break! ( URI . decode_query ( ) / 2 ) == 1
43- assert IEx.Pry . breaks ( ) == [ { 1 , URI , { :decode_query , 2 } , 1 } ]
42+ assert break! ( PryExampleModule . two ( ) / 2 ) == 1
43+ assert IEx.Pry . breaks ( ) == [ { 1 , PryExampleModule , { :two , 2 } , 1 } ]
4444 end
4545
4646 test "sets up a breakpoint with call syntax" do
47- assert break! ( URI . decode_query ( _ , % { } ) ) == 1
48- assert IEx.Pry . breaks ( ) == [ { 1 , URI , { :decode_query , 2 } , 1 } ]
47+ assert break! ( PryExampleModule . two ( _ , % { } ) ) == 1
48+ assert IEx.Pry . breaks ( ) == [ { 1 , PryExampleModule , { :two , 2 } , 1 } ]
4949 end
5050
5151 test "sets up a breakpoint with guards syntax" do
52- assert break! ( URI . decode_query ( _ , map ) when is_map ( map ) ) == 1
53- assert IEx.Pry . breaks ( ) == [ { 1 , URI , { :decode_query , 2 } , 1 } ]
52+ assert break! ( PryExampleModule . two ( _ , map ) when is_map ( map ) ) == 1
53+ assert IEx.Pry . breaks ( ) == [ { 1 , PryExampleModule , { :two , 2 } , 1 } ]
5454 end
5555
5656 test "sets up a breakpoint on the given module" do
57- assert break! ( URI , :decode_query , 2 ) == 1
58- assert IEx.Pry . breaks ( ) == [ { 1 , URI , { :decode_query , 2 } , 1 } ]
57+ assert break! ( PryExampleModule , :two , 2 ) == 1
58+ assert IEx.Pry . breaks ( ) == [ { 1 , PryExampleModule , { :two , 2 } , 1 } ]
5959 end
6060
6161 test "resets breaks on the given ID" do
62- assert break! ( URI , :decode_query , 2 ) == 1
62+ assert break! ( PryExampleModule , :two , 2 ) == 1
6363 assert reset_break ( 1 ) == :ok
64- assert IEx.Pry . breaks ( ) == [ { 1 , URI , { :decode_query , 2 } , 0 } ]
64+ assert IEx.Pry . breaks ( ) == [ { 1 , PryExampleModule , { :two , 2 } , 0 } ]
6565 end
6666
6767 test "resets breaks on the given module" do
68- assert break! ( URI , :decode_query , 2 ) == 1
69- assert reset_break ( URI , :decode_query , 2 ) == :ok
70- assert IEx.Pry . breaks ( ) == [ { 1 , URI , { :decode_query , 2 } , 0 } ]
68+ assert break! ( PryExampleModule , :two , 2 ) == 1
69+ assert reset_break ( PryExampleModule , :two , 2 ) == :ok
70+ assert IEx.Pry . breaks ( ) == [ { 1 , PryExampleModule , { :two , 2 } , 0 } ]
7171 end
7272
7373 test "removes breaks in the given module" do
74- assert break! ( URI . decode_query ( ) / 2 ) == 1
75- assert remove_breaks ( URI ) == :ok
74+ assert break! ( PryExampleModule . two ( ) / 2 ) == 1
75+ assert remove_breaks ( PryExampleModule ) == :ok
7676 assert IEx.Pry . breaks ( ) == [ ]
7777 end
7878
7979 test "removes breaks on all modules" do
80- assert break! ( URI . decode_query ( ) / 2 ) == 1
80+ assert break! ( PryExampleModule . two ( ) / 2 ) == 1
8181 assert remove_breaks ( ) == :ok
8282 assert IEx.Pry . breaks ( ) == [ ]
8383 end
8484
8585 test "errors when setting up a breakpoint with invalid guard" do
8686 assert capture_io ( :stderr , fn ->
8787 assert_raise CompileError , fn ->
88- break! ( URI . decode_query ( _ , map ) when is_whatever ( map ) )
88+ break! ( PryExampleModule . two ( _ , map ) when is_whatever ( map ) )
8989 end
9090 end ) =~ "cannot find or invoke local is_whatever/1"
9191 end
@@ -98,44 +98,44 @@ defmodule IEx.HelpersTest do
9898
9999 test "errors when setting up a break for unknown function" do
100100 assert_raise RuntimeError ,
101- "could not set breakpoint, unknown function/macro URI .unknown/2" ,
102- fn -> break! ( URI , :unknown , 2 ) end
101+ "could not set breakpoint, unknown function/macro #{ inspect ( PryExampleModule ) } .unknown/2" ,
102+ fn -> break! ( PryExampleModule , :unknown , 2 ) end
103103 end
104104
105105 test "errors for non-Elixir modules" do
106106 assert_raise RuntimeError ,
107- "could not set breakpoint, module :elixir was not written in Elixir" ,
108- fn -> break! ( :elixir , :unknown , 2 ) end
107+ "could not set breakpoint, module :maps was not written in Elixir" ,
108+ fn -> break! ( :maps , :unknown , 2 ) end
109109 end
110110
111111 test "prints table with breaks" do
112- break! ( URI , :decode_query , 2 )
112+ break! ( PryExampleModule , :two , 2 )
113113
114114 assert capture_io ( fn -> breaks ( ) end ) == """
115115
116- ID Module.function/arity Pending stops
117- ---- ----------------------- ---------------
118- 1 URI.decode_query/2 1
116+ ID Module.function/arity Pending stops
117+ ---- ------------------------ ---------------
118+ 1 PryExampleModule.two/2 1
119119
120120 """
121121
122- assert capture_io ( fn -> URI . decode_query ( "foo=bar" , % { } ) end ) != ""
122+ assert capture_io ( fn -> PryExampleModule . two ( "foo=bar" , % { } ) end ) != ""
123123
124124 assert capture_io ( fn -> breaks ( ) end ) == """
125125
126- ID Module.function/arity Pending stops
127- ---- ----------------------- ---------------
128- 1 URI.decode_query/2 0
126+ ID Module.function/arity Pending stops
127+ ---- ------------------------ ---------------
128+ 1 PryExampleModule.two/2 0
129129
130130 """
131131
132- assert capture_io ( fn -> URI . decode_query ( "foo=bar" , % { } ) end ) == ""
132+ assert capture_io ( fn -> PryExampleModule . two ( "foo=bar" , % { } ) end ) == ""
133133
134134 assert capture_io ( fn -> breaks ( ) end ) == """
135135
136- ID Module.function/arity Pending stops
137- ---- ----------------------- ---------------
138- 1 URI.decode_query/2 0
136+ ID Module.function/arity Pending stops
137+ ---- ------------------------ ---------------
138+ 1 PryExampleModule.two/2 0
139139
140140 """
141141 end
@@ -152,6 +152,7 @@ defmodule IEx.HelpersTest do
152152 @ lists_erl Application . app_dir ( :stdlib , "src/lists.erl" )
153153 @ httpc_erl "src/http_client/httpc.erl"
154154 @ editor System . get_env ( "ELIXIR_EDITOR" )
155+ @ example_module_path "lib/iex/test/test_helper.exs"
155156
156157 test "opens __FILE__ and __LINE__" do
157158 System . put_env ( "ELIXIR_EDITOR" , "echo __LINE__:__FILE__" )
@@ -163,7 +164,8 @@ defmodule IEx.HelpersTest do
163164 end
164165
165166 test "opens Elixir module" do
166- assert capture_iex ( "open(IEx.Helpers)" ) |> maybe_trim_quotes ( ) =~ ~r/ #{ @ iex_helpers } :5$/
167+ assert capture_iex ( "open(HelperExampleModule)" ) |> maybe_trim_quotes ( ) =~
168+ ~r/ #{ @ example_module_path } :\d +$/
167169 end
168170
169171 test "opens function" do
@@ -176,16 +178,19 @@ defmodule IEx.HelpersTest do
176178 end
177179
178180 test "opens module.function" do
179- assert capture_iex ( "open(IEx.Helpers.b)" ) |> maybe_trim_quotes ( ) =~ ~r/ #{ @ iex_helpers } :\d +$/
180- assert capture_iex ( "open(IEx.Helpers.h)" ) |> maybe_trim_quotes ( ) =~ ~r/ #{ @ iex_helpers } :\d +$/
181+ assert capture_iex ( "open(HelperExampleModule.fun)" ) |> maybe_trim_quotes ( ) =~
182+ ~r/ #{ @ example_module_path } :\d +$/
183+
184+ assert capture_iex ( "open(HelperExampleModule.macro)" ) |> maybe_trim_quotes ( ) =~
185+ ~r/ #{ @ example_module_path } :\d +$/
181186 end
182187
183188 test "opens module.function/arity" do
184- assert capture_iex ( "open(IEx.Helpers.b /1)" ) |> maybe_trim_quotes ( ) =~
185- ~r/ #{ @ iex_helpers } :\d +$/
189+ assert capture_iex ( "open(HelperExampleModule.fun /1)" ) |> maybe_trim_quotes ( ) =~
190+ ~r/ #{ @ example_module_path } :\d +$/
186191
187- assert capture_iex ( "open(IEx.Helpers.h/0 )" ) |> maybe_trim_quotes ( ) =~
188- ~r/ #{ @ iex_helpers } :\d +$/
192+ assert capture_iex ( "open(HelperExampleModule.macro/1 )" ) |> maybe_trim_quotes ( ) =~
193+ ~r/ #{ @ example_module_path } :\d +$/
189194 end
190195
191196 test "opens Erlang module" do
@@ -1440,11 +1445,13 @@ defmodule IEx.HelpersTest do
14401445 @ tag :capture_log
14411446 test "loads a given module on the given nodes" do
14421447 assert nl ( [ node ( ) ] , :lists ) == { :ok , [ { :nonode@nohost , :error , :sticky_directory } ] }
1443- assert nl ( [ node ( ) ] , Enum ) == { :ok , [ { :nonode@nohost , :loaded , Enum } ] }
1448+
1449+ assert nl ( [ node ( ) ] , HelperExampleModule ) ==
1450+ { :ok , [ { :nonode@nohost , :loaded , HelperExampleModule } ] }
14441451
14451452 assert nl ( :nonexistent_module ) == { :error , :nofile }
14461453
1447- assert nl ( [ :nosuchnode@badhost ] , Enum ) ==
1454+ assert nl ( [ :nosuchnode@badhost ] , HelperExampleModule ) ==
14481455 { :ok , [ { :nosuchnode@badhost , :badrpc , :noconnection } ] }
14491456 end
14501457 end
0 commit comments