dagger do action options flags

Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
Joel Longtine
2022-03-28 13:47:42 -06:00
parent 069227e30c
commit dae0ee1d1e
10 changed files with 341 additions and 46 deletions

23
plan/action_test.go Normal file
View File

@@ -0,0 +1,23 @@
package plan
import (
"testing"
"cuelang.org/go/cue"
"github.com/stretchr/testify/require"
)
func TestClosestSubPath(t *testing.T) {
rootPath := cue.MakePath(ActionSelector, cue.Str("test"))
path1 := cue.MakePath(ActionSelector, cue.Str("test"), cue.Str("one"))
path2 := cue.MakePath(ActionSelector, cue.Str("test"), cue.Str("two"))
require.Equal(t, "actions.test.one", path1.String())
require.Equal(t, "actions.test.two", path2.String())
require.Equal(t, "actions.test", commonSubPath(rootPath, path1).String())
require.Equal(t, "actions.test", commonSubPath(path1, path2).String())
path3 := cue.MakePath(ActionSelector, cue.Str("test"), cue.Str("golang"), cue.Str("three"))
path4 := cue.MakePath(ActionSelector, cue.Str("test"), cue.Str("java"), cue.Str("three"))
require.Equal(t, "actions.test", commonSubPath(path3, path4).String())
}