File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ julia = "0.7, 1"
1010
1111[extras ]
1212Colors = " 5ae59095-9a9b-59fe-a467-6f913c188581"
13+ Example = " 7876af07-990d-54b4-ab0e-23690620f79a"
1314Test = " 8dfed614-e22c-5e08-85e1-65c5234f0b40"
1415
1516[targets ]
16- test = [" Test" , " Colors" ]
17+ test = [" Test" , " Colors" , " Example " ]
Original file line number Diff line number Diff line change 11[deps ]
22Colors = " 5ae59095-9a9b-59fe-a467-6f913c188581"
3+ Example = " 7876af07-990d-54b4-ab0e-23690620f79a"
34Test = " 8dfed614-e22c-5e08-85e1-65c5234f0b40"
Original file line number Diff line number Diff line change 1+ name = " NotifyMe"
2+ uuid = " 545cf9b9-f575-4090-a54a-9a5287d37f74"
3+ authors = [" Tim Holy <tim.holy@gmail.com>" ]
4+ version = " 0.1.0"
5+
6+ [deps ]
7+ Requires = " ae029012-a4dd-5104-9daa-d747884805df"
8+ UUIDs = " cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Original file line number Diff line number Diff line change 1+ module NotifyMe
2+
3+ using Requires, UUIDs
4+
5+ const notified_args = []
6+ add_require (args... ) = push! (notified_args, args)
7+
8+ function __init__ ()
9+ push! (Requires. notified_pkgs, Base. PkgId (UUID (0x545cf9b9f5754090a54a9a5287d37f74 ), " NotifyMe" ))
10+ end
11+
12+ end # module
Original file line number Diff line number Diff line change 113113 @eval using FooAfterPC
114114 @eval using FooSubAfterNPC
115115 @eval using FooSubAfterPC
116+
117+ pop! (LOAD_PATH )
118+
116119 @test FooAfterNPC. flag
117120 @test FooAfterPC. flag
118121 @test :SubModule in names (FooSubAfterNPC)
121124 @test FooSubAfterPC. SubModule. flag
122125 end
123126end
127+
128+ module EvalModule end
129+
130+ @testset " Notifications" begin
131+ push! (LOAD_PATH , joinpath (@__DIR__ , " pkgs" ))
132+ @eval using NotifyMe
133+
134+ mktempdir () do pkgsdir
135+ ndir = joinpath (" NotifyTarget" , " src" )
136+ cd (pkgsdir) do
137+ mkpath (ndir)
138+ cd (ndir) do
139+ open (" NotifyTarget.jl" , " w" ) do io
140+ println (io, """
141+ module NotifyTarget
142+ using Requires
143+ function __init__()
144+ @require Example="7876af07-990d-54b4-ab0e-23690620f79a" begin
145+ f(x) = 2x
146+ end
147+ end
148+ end
149+ """ )
150+ end
151+ end
152+ end
153+ push! (LOAD_PATH , pkgsdir)
154+ @test isempty (NotifyMe. notified_args)
155+ @eval using NotifyTarget
156+ @test isempty (NotifyMe. notified_args)
157+ @eval using Example
158+ @test length (NotifyMe. notified_args) == 1
159+ nargs = NotifyMe. notified_args[1 ]
160+ @test nargs[1 ] == joinpath (pkgsdir, ndir, " NotifyTarget.jl" )
161+ @test nargs[2 ] == NotifyTarget
162+ @test nargs[3 ] == " 7876af07-990d-54b4-ab0e-23690620f79a"
163+ @test nargs[4 ] == " Example"
164+ Core. eval (EvalModule, nargs[5 ])
165+ @test Base. invokelatest (EvalModule. f, 3 ) == 6
166+ end
167+
168+ pop! (LOAD_PATH )
169+ end
You can’t perform that action at this time.
0 commit comments