forked from fonsp/Pluto.jl
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAnalysis.jl
39 lines (35 loc) · 987 Bytes
/
Analysis.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
using Test
import Neptune: Notebook, ServerSession, ClientSession, Cell, update_caches!, updated_topology, is_just_text
@testset "Analysis" begin
notebook = Notebook([
Cell(""),
Cell("md\"a\""),
Cell("html\"a\""),
Cell("md\"a \$b\$\""),
Cell("""
let
x = md"a"
md"r \$x"
end
"""),
Cell("html\"a \$b\""),
Cell("md\"a \$b\""),
Cell("@a md\"asdf\""),
Cell("x()"),
Cell("x() = y()"),
Cell("1 + 1"),
Cell("import Dates"),
Cell("import Dates"),
])
update_caches!(notebook, notebook.cells)
old = notebook.topology
new = notebook.topology = updated_topology(old, notebook, notebook.cells)
@testset "Only-text detection" begin
for c in notebook.cells[1:6]
@test is_just_text(new, c)
end
for c in notebook.cells[7:end]
@test !is_just_text(new, c)
end
end
end