File tree 3 files changed +5
-45
lines changed 3 files changed +5
-45
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package filepath_test
6
6
7
7
import (
8
8
"fmt"
9
+ "internal/testenv"
9
10
"io/ioutil"
10
11
"os"
11
12
. "path/filepath"
@@ -174,15 +175,7 @@ var globSymlinkTests = []struct {
174
175
}
175
176
176
177
func TestGlobSymlink (t * testing.T ) {
177
- switch runtime .GOOS {
178
- case "android" , "nacl" , "plan9" :
179
- t .Skipf ("skipping on %s" , runtime .GOOS )
180
- case "windows" :
181
- if ! supportsSymlinks {
182
- t .Skipf ("skipping on %s" , runtime .GOOS )
183
- }
184
-
185
- }
178
+ testenv .MustHaveSymlink (t )
186
179
187
180
tmpDir , err := ioutil .TempDir ("" , "globsymlink" )
188
181
if err != nil {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package filepath_test
6
6
7
7
import (
8
8
"errors"
9
+ "internal/testenv"
9
10
"io/ioutil"
10
11
"os"
11
12
"path/filepath"
@@ -15,8 +16,6 @@ import (
15
16
"testing"
16
17
)
17
18
18
- var supportsSymlinks = true
19
-
20
19
type PathTest struct {
21
20
path , result string
22
21
}
@@ -776,13 +775,7 @@ func simpleJoin(dir, path string) string {
776
775
}
777
776
778
777
func TestEvalSymlinks (t * testing.T ) {
779
- switch runtime .GOOS {
780
- case "android" , "nacl" , "plan9" :
781
- t .Skipf ("skipping on %s" , runtime .GOOS )
782
- }
783
- if ! supportsSymlinks {
784
- t .Skip ("skipping because symlinks are not supported" )
785
- }
778
+ testenv .MustHaveSymlink (t )
786
779
787
780
tmpDir , err := ioutil .TempDir ("" , "evalsymlink" )
788
781
if err != nil {
@@ -896,13 +889,7 @@ func TestEvalSymlinks(t *testing.T) {
896
889
}
897
890
898
891
func TestIssue13582 (t * testing.T ) {
899
- switch runtime .GOOS {
900
- case "android" , "nacl" , "plan9" :
901
- t .Skipf ("skipping on %s" , runtime .GOOS )
902
- }
903
- if ! supportsSymlinks {
904
- t .Skip ("skipping because symlinks are not supported" )
905
- }
892
+ testenv .MustHaveSymlink (t )
906
893
907
894
tmpDir , err := ioutil .TempDir ("" , "issue13582" )
908
895
if err != nil {
Original file line number Diff line number Diff line change @@ -13,29 +13,9 @@ import (
13
13
"path/filepath"
14
14
"reflect"
15
15
"strings"
16
- "syscall"
17
16
"testing"
18
17
)
19
18
20
- func init () {
21
- tmpdir , err := ioutil .TempDir ("" , "symtest" )
22
- if err != nil {
23
- panic ("failed to create temp directory: " + err .Error ())
24
- }
25
- defer os .RemoveAll (tmpdir )
26
-
27
- err = os .Symlink ("target" , filepath .Join (tmpdir , "symlink" ))
28
- if err == nil {
29
- return
30
- }
31
-
32
- err = err .(* os.LinkError ).Err
33
- switch err {
34
- case syscall .EWINDOWS , syscall .ERROR_PRIVILEGE_NOT_HELD :
35
- supportsSymlinks = false
36
- }
37
- }
38
-
39
19
func TestWinSplitListTestsAreValid (t * testing.T ) {
40
20
comspec := os .Getenv ("ComSpec" )
41
21
if comspec == "" {
You can’t perform that action at this time.
0 commit comments