Skip to content

Commit ab29b81

Browse files
committed
tests: use t.Chdir now that we are on Go 1.24
1 parent 19d09ff commit ab29b81

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

integration/nonmodulefiles/nonmodulefiles_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import (
1515
func TestNonModuleFiles(t *testing.T) {
1616
// Run this whole test in a throw-away temporary directory to not litter the
1717
// gokrazy/tools repository working copy.
18-
parent := t.TempDir()
18+
t.Chdir(t.TempDir())
1919

2020
// create a new instance
21+
parent := t.TempDir()
2122
c := gok.Context{
2223
Args: []string{
2324
"--parent_dir=" + parent,

integration/relative/relative_test.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,7 @@ import (
1313
func TestRelativeParentDir(t *testing.T) {
1414
// Run this whole test in a throw-away temporary directory to not litter the
1515
// gokrazy/tools repository working copy.
16-
17-
// TODO(go1.24): use t.Chdir()
18-
oldwd, err := os.Open(".")
19-
if err != nil {
20-
t.Fatal(err)
21-
}
22-
if err := os.Chdir(t.TempDir()); err != nil {
23-
t.Fatal(err)
24-
}
25-
t.Cleanup(func() {
26-
err := oldwd.Chdir()
27-
oldwd.Close()
28-
if err != nil {
29-
t.Fatal(err)
30-
}
31-
})
16+
t.Chdir(t.TempDir())
3217

3318
// create a new instance
3419
c := gok.Context{

0 commit comments

Comments
 (0)