Skip to content

Commit 46e440a

Browse files
committed
rename file for pathlists
1 parent 0ce9dbc commit 46e440a

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

internal/impl/devbox.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ func (d *Devbox) EnvVars(ctx context.Context) ([]string, error) {
325325
}
326326

327327
func (d *Devbox) ShellEnvHash(ctx context.Context) (string, error) {
328-
// TODO savil: correct?
329328
envs, err := d.nixEnv(ctx)
330329
if err != nil {
331330
return "", err
File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package envpath
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func TestCleanEnvPath(t *testing.T) {
8+
tests := []struct {
9+
name string
10+
inPath string
11+
outPath string
12+
}{
13+
{
14+
name: "NoEmptyPaths",
15+
inPath: "/usr/local/bin::",
16+
outPath: "/usr/local/bin",
17+
},
18+
{
19+
name: "NoRelativePaths",
20+
inPath: "/usr/local/bin:/usr/bin:../test:/bin:/usr/sbin:/sbin:.:..",
21+
outPath: "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
22+
},
23+
}
24+
for _, test := range tests {
25+
t.Run(test.name, func(t *testing.T) {
26+
got := JoinPathLists(test.inPath)
27+
if got != test.outPath {
28+
t.Errorf("Got incorrect cleaned PATH.\ngot: %s\nwant: %s", got, test.outPath)
29+
}
30+
})
31+
}
32+
}

internal/impl/shell_test.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"testing"
1414

1515
"github.com/google/go-cmp/cmp"
16-
"go.jetpack.io/devbox/internal/impl/envpath"
1716
"go.jetpack.io/devbox/internal/shellgen"
1817
)
1918

@@ -106,30 +105,3 @@ If the new shellrc is correct, you can update the golden file with:
106105
})
107106
}
108107
}
109-
110-
func TestCleanEnvPath(t *testing.T) {
111-
tests := []struct {
112-
name string
113-
inPath string
114-
outPath string
115-
}{
116-
{
117-
name: "NoEmptyPaths",
118-
inPath: "/usr/local/bin::",
119-
outPath: "/usr/local/bin",
120-
},
121-
{
122-
name: "NoRelativePaths",
123-
inPath: "/usr/local/bin:/usr/bin:../test:/bin:/usr/sbin:/sbin:.:..",
124-
outPath: "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
125-
},
126-
}
127-
for _, test := range tests {
128-
t.Run(test.name, func(t *testing.T) {
129-
got := envpath.JoinPathLists(test.inPath)
130-
if got != test.outPath {
131-
t.Errorf("Got incorrect cleaned PATH.\ngot: %s\nwant: %s", got, test.outPath)
132-
}
133-
})
134-
}
135-
}

0 commit comments

Comments
 (0)