From 17aa37499614863ccec50e30d679124d3e82ccfd Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 6 Jun 2023 13:33:56 -0700 Subject: [PATCH] e2etests-cli: Add import test --- e2etests-cli/main_test.go | 13 +++ .../testdata/TestCLI_E2E/import.exp.svg | 95 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 e2etests-cli/testdata/TestCLI_E2E/import.exp.svg diff --git a/e2etests-cli/main_test.go b/e2etests-cli/main_test.go index 6cb6342356..1ce1d5ff4a 100644 --- a/e2etests-cli/main_test.go +++ b/e2etests-cli/main_test.go @@ -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() diff --git a/e2etests-cli/testdata/TestCLI_E2E/import.exp.svg b/e2etests-cli/testdata/TestCLI_E2E/import.exp.svg new file mode 100644 index 0000000000..5a7b0b15fe --- /dev/null +++ b/e2etests-cli/testdata/TestCLI_E2E/import.exp.svg @@ -0,0 +1,95 @@ +xy + + +