Add E2E test

This commit is contained in:
Nathan Sarang-Walters 2024-12-16 15:29:21 -08:00
parent 1240b90475
commit e88e243d4c
No known key found for this signature in database
GPG key ID: D5486C14E4309B0E

View file

@ -1005,6 +1005,19 @@ layers: {
assert.Equal(t, "x -> y\n", string(gotBar))
},
},
{
name: "fmt-check",
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
writeFile(t, dir, "foo.d2", `a ---> b`)
writeFile(t, dir, "bar.d2", `x ---> y`)
err := runTestMainPersist(t, ctx, dir, env, "fmt", "--check", "foo.d2", "bar.d2")
assert.ErrorString(t, err, "failed to wait xmain test: e2etests-cli/d2: failed to fmt: exiting with code 1: found 2 unformatted files. Run d2 fmt to fix.")
gotFoo := readFile(t, dir, "foo.d2")
gotBar := readFile(t, dir, "bar.d2")
assert.Equal(t, "a ---> b", string(gotFoo))
assert.Equal(t, "x ---> y", string(gotBar))
},
},
{
name: "watch-regular",
serial: true,