Skip to content

Commit eba24df

Browse files
committed
Address testrunner and lo changes.
1 parent d051ac0 commit eba24df

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

internal/devconfig/config.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414

1515
"github.com/pkg/errors"
1616
"github.com/samber/lo"
17+
"github.com/samber/lo/mutable"
1718
"go.jetify.com/devbox/internal/build"
1819
"go.jetify.com/devbox/internal/cachehash"
1920
"go.jetify.com/devbox/internal/devbox/shellcmd"
@@ -333,10 +334,14 @@ func (c *Config) Packages(
333334
}
334335

335336
// Keep only the last occurrence of each package (by name).
336-
return lo.Reverse(lo.UniqBy(
337-
lo.Reverse(packages),
337+
mutable.Reverse(packages)
338+
packages = lo.UniqBy(
339+
packages,
338340
func(p configfile.Package) string { return p.Name },
339-
))
341+
)
342+
mutable.Reverse(packages)
343+
344+
return packages
340345
}
341346

342347
func (c *Config) NixPkgsCommitHash() string {

testscripts/testrunner/testrunner.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ import (
1515
"go.jetify.com/devbox/internal/boxcli"
1616
)
1717

18-
func Main(m *testing.M) int {
19-
commands := map[string]func() int{
20-
"devbox": func() int {
18+
func Main(m *testing.M) {
19+
commands := map[string]func(){
20+
"devbox": func() {
2121
// Call the devbox CLI directly:
22-
return boxcli.Execute(context.Background(), os.Args[1:])
22+
boxcli.Execute(context.Background(), os.Args[1:])
2323
},
24-
"print": func() int { // Not 'echo' because we don't expand variables
24+
"print": func() { // Not 'echo' because we don't expand variables
2525
fmt.Println(strings.Join(os.Args[1:], " "))
26-
return 0
2726
},
2827
}
29-
return testscript.RunMain(m, commands)
28+
testscript.Main(m, commands)
3029
}
3130

3231
func RunTestscripts(t *testing.T, testscriptsDir string) {

testscripts/testscripts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestScripts(t *testing.T) {
1919
}
2020

2121
func TestMain(m *testing.M) {
22-
os.Exit(testrunner.Main(m))
22+
testrunner.Main(m)
2323
}
2424

2525
// TestExamples runs testscripts on the devbox-projects in the examples folder.

0 commit comments

Comments
 (0)