Skip to content

Commit

Permalink
Merge pull request #2077 from alixander/allow-unfound-board
Browse files Browse the repository at this point in the history
allow unfound boards
  • Loading branch information
alixander authored Aug 26, 2024
2 parents d507f12 + 1d6adef commit b6a9268
Show file tree
Hide file tree
Showing 5 changed files with 1,185 additions and 22 deletions.
2 changes: 1 addition & 1 deletion d2compiler/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ func (c *compiler) validateBoardLinks(g *d2graph.Graph) {
}

if !hasBoard(g.RootBoard(), linkKey.IDA()) {
c.errorf(obj.Link.MapKey, "linked board not found")
obj.Link = nil
continue
}
}
Expand Down
13 changes: 10 additions & 3 deletions d2compiler/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,9 @@ scenarios: {
name: "link-board-not-found",
text: `x.link: layers.x
`,
expErr: `d2/testdata/d2compiler/TestCompile/link-board-not-found.d2:1:1: linked board not found`,
assertions: func(t *testing.T, g *d2graph.Graph) {
tassert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[0].Link)
},
},
{
name: "link-board-not-board",
Expand All @@ -2299,7 +2301,10 @@ layers: {
y
}
}`,
expErr: `d2/testdata/d2compiler/TestCompile/link-board-not-board.d2:2:1: linked board not found`,

assertions: func(t *testing.T, g *d2graph.Graph) {
tassert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[0].Link)
},
},
{
name: "link-board-nested",
Expand Down Expand Up @@ -2394,7 +2399,9 @@ layers: {
}
}
}`,
expErr: `d2/testdata/d2compiler/TestCompile/link-board-underscore-not-found.d2:7:9: linked board not found`,
assertions: func(t *testing.T, g *d2graph.Graph) {
tassert.Equal(t, (*d2graph.Scalar)(nil), g.Layers[0].Layers[0].Objects[0].Link)
},
},
{
name: "import-icon-near",
Expand Down
Loading

0 comments on commit b6a9268

Please sign in to comment.