@@ -21,8 +21,8 @@ defmodule Kernel.LexicalTrackerTest do
2121 assert D . references ( config [ :pid ] ) == { [ String ] , [ ] , [ ] , [ ] }
2222 end
2323
24- test "can add requires" , config do
25- D . add_require ( config [ :pid ] , URI )
24+ test "can add module requires and exports " , config do
25+ D . add_export ( config [ :pid ] , URI )
2626 assert D . references ( config [ :pid ] ) == { [ ] , [ URI ] , [ ] , [ ] }
2727
2828 D . remote_dispatch ( config [ :pid ] , URI , :runtime )
@@ -33,7 +33,6 @@ defmodule Kernel.LexicalTrackerTest do
3333 end
3434
3535 test "can add module imports" , config do
36- D . add_require ( config [ :pid ] , String )
3736 D . add_import ( config [ :pid ] , String , [ ] , 1 , true )
3837
3938 D . import_dispatch ( config [ :pid ] , String , { :upcase , 1 } , :runtime )
@@ -44,7 +43,7 @@ defmodule Kernel.LexicalTrackerTest do
4443 end
4544
4645 test "can add module with {function, arity} imports" , config do
47- D . add_require ( config [ :pid ] , String )
46+ D . add_export ( config [ :pid ] , String )
4847 D . add_import ( config [ :pid ] , String , [ upcase: 1 ] , 1 , true )
4948
5049 D . import_dispatch ( config [ :pid ] , String , { :upcase , 1 } , :compile )
@@ -181,18 +180,18 @@ defmodule Kernel.LexicalTrackerTest do
181180 { { compile , _exports , runtime , _ } , _binding } =
182181 Code . eval_string ( """
183182 defmodule Kernel.LexicalTrackerTest.Defdelegate do
184- defdelegate a , to: A
183+ defdelegate parse(arg) , to: URI
185184
186- opts = [to: B ]
187- defdelegate b , opts
185+ opts = [to: Range ]
186+ defdelegate disjoint?(left, right) , opts
188187
189188 Kernel.LexicalTracker.references(__ENV__.lexical_tracker)
190189 end |> elem(3)
191190 """ )
192191
193- refute A in compile
194- assert B in compile
195- assert A in runtime
192+ refute URI in compile
193+ assert Range in compile
194+ assert URI in runtime
196195 end
197196
198197 test "imports adds an export dependency" do
@@ -209,6 +208,20 @@ defmodule Kernel.LexicalTrackerTest do
209208 refute String in runtime
210209 end
211210
211+ test "requires adds a compile dependency" do
212+ { { compile , exports , runtime , _ } , _binding } =
213+ Code . eval_string ( """
214+ defmodule Kernel.LexicalTrackerTest.Requires do
215+ require String
216+ Kernel.LexicalTracker.references(__ENV__.lexical_tracker)
217+ end |> elem(3)
218+ """ )
219+
220+ assert String in compile
221+ refute String in exports
222+ refute String in runtime
223+ end
224+
212225 test "structs are exports or compile time" do
213226 { { compile , exports , runtime , _ } , _binding } =
214227 Code . eval_string ( """
0 commit comments