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/plan/action_test.go
Joel Longtine dae0ee1d1e
dagger do action options flags
Signed-off-by: Joel Longtine <joel@dagger.io>
2022-04-15 13:54:41 -06:00

24 lines
857 B
Go

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