This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/dagger/input_test.go
Solomon Hykes 0202f4447b Don't instantiate a global shared Env in cmd/compute.go
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-02-05 15:27:19 -08:00

36 lines
597 B
Go

package dagger
import (
"context"
"testing"
)
func TestEnvInputFlag(t *testing.T) {
env, err := NewEnv(nil)
if err != nil {
t.Fatal(err)
}
input, err := NewInputValue(env.Compiler(), `{}`)
if err != nil {
t.Fatal(err)
}
if err := input.DirFlag().Set("www.source=."); err != nil {
t.Fatal(err)
}
if err := env.SetInput(input.Value()); err != nil {
t.Fatal(err)
}
localdirs, err := env.LocalDirs(context.TODO())
if err != nil {
t.Fatal(err)
}
if len(localdirs) != 1 {
t.Fatal(localdirs)
}
if dir, ok := localdirs["."]; !ok || dir != "." {
t.Fatal(localdirs)
}
}