Repository navigation
Expand file tree
/
Copy pathtodo_test.go
More file actions
280 lines (260 loc) · 5.2 KB
/
Copy pathtodo_test.go
File metadata and controls
280 lines (260 loc) · 5.2 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
package e2etests
import (
_ "embed"
"testing"
)
func testTodo(t *testing.T) {
tcs := []testCase{
{
// issue https://github.com/terrastruct/d2/issues/71
name: "container_child_edge",
script: `
container.first -> container.second: 1->2
container -> container.second: c->2
`,
dagreFeatureError: `Connection "(container -> container.second)[0]" goes from a container to a descendant, but layout engine "dagre" does not support this.`,
},
{
name: "child_parent_edges",
script: `a.b -> a
a.b -> a.b.c
a.b.c.d -> a.b`,
dagreFeatureError: `Connection "(a.b -> a)[0]" goes from a container to a descendant, but layout engine "dagre" does not support this.`,
},
{
name: "container_label_loop",
script: `a: "If we were meant to fly, we wouldn't keep losing our luggage" {
b -> c
}
a -> a`,
dagreFeatureError: `Connection "(a -> a)[0]" is a self loop on a container, but layout engine "dagre" does not support this.`,
},
{
// as nesting gets deeper, the groups advance towards `c` and may overlap its lifeline
// needs to consider the group size when computing the distance from `a` to `c`
// a similar effect can be seen for spans
name: "sequence_diagram_actor_padding_nested_groups",
script: `shape: sequence_diagram
b;a;c
b -> c
this is a message group: {
a -> b
and this is a nested message group: {
a -> b
what about more nesting: {
a -> b
yo: {
a -> b
yo: {
a -> b
}
}
}
}
}`,
},
{
// dimensions set on containers are ignored
name: "shape_set_width_height",
script: `
containers: {
circle container: {
shape: circle
diamond: {
shape: diamond
width: 128
height: 64
}
}
diamond container: {
shape: diamond
circle: {
shape: circle
width: 128
}
}
oval container: {
shape: oval
hexagon: {
shape: hexagon
width: 128
height: 64
}
}
hexagon container: {
shape: hexagon
oval: {
shape: oval
width: 128
height: 64
}
}
}
cloud: {
shape: cloud
width: 512
height: 256
}
tall cylinder: {
shape: cylinder
width: 256
height: 512
}
cloud -> class -> tall cylinder -> users
users: {
shape: sql_table
id: int
name: string
email: string
password: string
last_login: datetime
width: 800
height: 400
}
class: {
shape: class
-num: int
-timeout: int
-pid
+getStatus(): Enum
+getJobs(): "Job[]"
+setTimeout(seconds int)
width: 800
height: 400
}
container -> text -> code -> small code
text: {
label: |md
markdown text expanded to 800x400
|
height: 800
width: 400
}
code: |go
a := 5
b := a + 7
fmt.Printf("%d", b)
| {
width: 400
height: 300
}
small code: |go
a := 5
b := a + 7
fmt.Printf("%d", b)
| {
width: 4
height: 3
}
`,
},
{
// issue https://github.com/terrastruct/d2/issues/748
name: "sequence_diagram_edge_group_span_field",
script: `
Office chatter: {
shape: sequence_diagram
alice: Alice
bob: Bobby
alice.a
awkward small talk: {
alice -> bob: uhm, hi
bob -> alice: oh, hello
icebreaker attempt: {
alice -> bob: what did you have for lunch?
}
unfortunate outcome: {
bob.a -> alice.a: that's personal
}
}
}
`,
},
{
// issue https://github.com/terrastruct/d2/issues/748
skip: true,
name: "sequence_diagram_ambiguous_edge_group",
script: `
Office chatter: {
shape: sequence_diagram
alice: Alice
bob: Bobby
awkward small talk: {
awkward small talk.ok
alice -> bob: uhm, hi
bob -> alice: oh, hello
icebreaker attempt: {
alice -> bob: what did you have for lunch?
}
unfortunate outcome: {
bob -> alice: that's personal
}
}
}
`,
},
{
// https://github.com/terrastruct/d2/issues/791
name: "container_icon_label",
script: `a: Big font {
icon: https://icons.terrastruct.com/essentials/004-picture.svg
style.font-size: 30
a -> b -> c
a: {
a
}
}
`,
},
{
name: "container_label_edge_adjustment",
script: `
a -> b.c -> d: {style.stroke-width: 8; target-arrowhead.shape: diamond; target-arrowhead.style.filled: true}
b.shape: cloud
e -> b.c: {style.stroke-width: 8; target-arrowhead.shape: diamond; target-arrowhead.style.filled: true}
f -> b: {
style: {
stroke: red
stroke-width: 8
}
target-arrowhead.shape: diamond
target-arrowhead.style.filled: true
}
g -> b: {style.stroke-width: 8; target-arrowhead.shape: diamond; target-arrowhead.style.filled: true}
b: a container label
`,
},
{
name: "container_label_edge_adjustment2",
script: `
x -> y: {
target-arrowhead: foo {
shape: diamond
style.filled: true
}
}
y: bar {z}
`,
},
{
name: "dagre_container_md_label_panic",
script: `
OEM Factory -> company Warehouse
company Warehouse.Master -> company Warehouse.Regional-1
company Warehouse.Master -> company Warehouse.Regional-2
company Warehouse.Master -> company Warehouse.Regional-N
company Warehouse.Regional-1 -> company Warehouse.Regional-2
company Warehouse.Regional-2 -> company Warehouse.Regional-N
company Warehouse.Regional-N -> company Warehouse.Regional-1
company Warehouse: |md
### company Warehouse
- Asset Tagging
- Inventory
- Staging
- Dispatch to Site
|
`,
},
}
runa(t, tcs)
}