fix and add tests

This commit is contained in:
Bernard Xie 2023-06-20 13:07:34 -07:00
parent 456799430d
commit 4bd5642e62
No known key found for this signature in database
GPG key ID: 3C3E0036CE0F892C
2 changed files with 15 additions and 1 deletions

View file

@ -335,7 +335,7 @@ func (p *printer) _map(m *d2ast.Map) {
if n.GetRange().Start.Line != 0 {
p.newline()
}
if len(m.Nodes) > len(boards) {
if i != 0 || len(m.Nodes) > len(boards) {
p.newline()
}
p.node(n)

View file

@ -670,6 +670,9 @@ x: @"x/../file"
}
}
}
steps: {
a
}
}
`,
exp: `layers: {
@ -682,6 +685,10 @@ x: @"x/../file"
}
}
}
steps: {
a
}
}
`,
},
@ -740,6 +747,9 @@ only-layers: {
X
Y
}
layers: {
Z
}
}
`,
exp: `a
@ -753,6 +763,10 @@ only-layers: {
X
Y
}
layers: {
Z
}
}
layers: {