Skip to content

Commit

Permalink
e2etests-cli: Add import test
Browse files Browse the repository at this point in the history
  • Loading branch information
nhooyr committed Jun 6, 2023
1 parent f6fd419 commit 17aa374
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
13 changes: 13 additions & 0 deletions e2etests-cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,19 @@ steps: {
assert.Testdata(t, ".svg", svg)
},
},
{
name: "import",
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
writeFile(t, dir, "hello-world.d2", `x: @x; y: @y; ...@p`)
writeFile(t, dir, "x.d2", `shape: circle`)
writeFile(t, dir, "y.d2", `shape: square`)
writeFile(t, dir, "p.d2", `x -> y`)
err := runTestMain(t, ctx, dir, env, filepath.Join(dir, "hello-world.d2"))
assert.Success(t, err)
svg := readFile(t, dir, "hello-world.svg")
assert.Testdata(t, ".svg", svg)
},
},
}

ctx := context.Background()
Expand Down
95 changes: 95 additions & 0 deletions e2etests-cli/testdata/TestCLI_E2E/import.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 17aa374

Please sign in to comment.