Skip to content

Commit 93a3a08

Browse files
committed
Add and fix tests.
1 parent adf82fd commit 93a3a08

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

test/tutorial/3_files.jl

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ simple_str = mktemp() do file, io
3535
end
3636

3737
print(simple_str) #md
38-
@test simple_str == "graph T {\n a\n b\n a -- b\n}\n" #src
38+
@test simple_str == "graph T {\n \"a\"\n \"b\"\n \"a\" -- \"b\"\n}\n" #src
3939

4040
#-
4141

@@ -60,4 +60,32 @@ end
6060

6161
print(complicated_str) #md
6262
@test complicated_str == #src
63-
"digraph G {\n tagged = true\n a [code_1 = 1, code_2 = 2]\n b [code = 2]\n a -> b [code = 12]\n}\n" #src
63+
"digraph G {\n tagged = true\n \"a\" [code_1 = 1, code_2 = 2]\n \"b\" [code = 2]\n \"a\" -> \"b\" [code = 12]\n}\n" #src
64+
65+
with_spaces = MetaGraph(
66+
DiGraph();
67+
label_type=String,
68+
vertex_data_type=Dict{Symbol,String},
69+
edge_data_type=Dict{Symbol,String},
70+
)
71+
72+
with_spaces["a b"] = Dict(:label => "A B")
73+
74+
with_spaces["c d"] = Dict(:label => "C D")
75+
76+
with_spaces["a b", "c d"] = Dict(:label => "A B to C D")
77+
78+
with_spaces_str = mktemp() do file, io
79+
savegraph(file, with_spaces, DOTFormat())
80+
read(file, String)
81+
end
82+
83+
print(with_spaces_str)
84+
@test with_spaces_str ==
85+
"""
86+
digraph G {
87+
"a b" [label = "A B"]
88+
"c d" [label = "C D"]
89+
"a b" -> "c d" [label = "A B to C D"]
90+
}
91+
"""

0 commit comments

Comments
 (0)