MCPcopy Create free account
hub / github.com/dagger/dagger / TestNormalizeWorkspaceRemoteSubdir

Function TestNormalizeWorkspaceRemoteSubdir

engine/server/session_test.go:769–791  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

767}
768
769func TestNormalizeWorkspaceRemoteSubdir(t *testing.T) {
770 t.Parallel()
771
772 t.Run("empty becomes dot", func(t *testing.T) {
773 t.Parallel()
774 got, err := normalizeWorkspaceRemoteSubdir("")
775 require.NoError(t, err)
776 require.Equal(t, ".", got)
777 })
778
779 t.Run("absolute gets normalized to relative", func(t *testing.T) {
780 t.Parallel()
781 got, err := normalizeWorkspaceRemoteSubdir("/toolchains/changelog")
782 require.NoError(t, err)
783 require.Equal(t, "toolchains/changelog", got)
784 })
785
786 t.Run("rejects escaping paths", func(t *testing.T) {
787 t.Parallel()
788 _, err := normalizeWorkspaceRemoteSubdir("../outside")
789 require.ErrorContains(t, err, "outside repository")
790 })
791}
792
793func stringPtr(v string) *string {
794 return &v

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected