-
Notifications
You must be signed in to change notification settings - Fork 18
/
connections.jl
47 lines (37 loc) · 1.31 KB
/
connections.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import PlutoSliderServer
import PlutoSliderServer.MoreAnalysis
import PlutoSliderServer.Pluto
using Test
file = joinpath(@__DIR__, "parallelpaths4.jl")
newpath = tempname()
Pluto.readwrite(file, newpath)
notebook = Pluto.load_notebook(newpath)
# Run pluto's analysis. This is like opening the notebook, without actually running it
# s = Pluto.ServerSession()
# Pluto.update_save_run!(s, notebook, notebook.cells; run)
notebook.topology = Pluto.updated_topology(notebook.topology, notebook, notebook.cells)
# bound_variables = (map(notebook.cells) do cell
# MoreAnalysis.find_bound_variables(cell.parsedcode)
# end)
# @show bound_variables
connections = MoreAnalysis.bound_variable_connections_graph(notebook)
# @show connections
@test !isempty(connections)
wanted_connections = Dict(
:x => [:y, :x],
:y => [:y, :x],
:show_dogs => [:show_dogs],
:b => [:b],
:c => [:c],
:five1 => [:five1],
:five2 => [:five2],
:six1 => [:six2, :six1],
:six2 => [:six3, :six2, :six1],
:six3 => [:six3, :six2],
:cool1 => [:cool1, :cool2],
:cool2 => [:cool1, :cool2],
:world => [:world],
:boring => [:boring],
)
transform(d) = Dict(k => sort(v) for (k, v) in d)
@test transform(connections) == transform(wanted_connections)