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

36 lines
597 B
Go
Raw Normal View History

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)
}
}