github.com/gsquire/gb@v0.4.4-0.20161112235727-3982dc872064/internal/fileutils/fileutils_test.go (about)

     1  package fileutils
     2  
     3  import (
     4  	"io/ioutil"
     5  	"path/filepath"
     6  	"runtime"
     7  	"testing"
     8  )
     9  
    10  func TestCopypathSkipsSymlinks(t *testing.T) {
    11  	if runtime.GOOS == "windows" {
    12  		t.Skip("no symlinks on windows y'all")
    13  	}
    14  	dst := mktemp(t)
    15  	defer RemoveAll(dst)
    16  	src := filepath.Join("_testdata", "copyfile", "a")
    17  	if err := Copypath(dst, src); err != nil {
    18  		t.Fatalf("copypath(%s, %s): %v", dst, src, err)
    19  	}
    20  }
    21  
    22  func mktemp(t *testing.T) string {
    23  	s, err := ioutil.TempDir("", "fileutils_test")
    24  	if err != nil {
    25  		t.Fatal(err)
    26  	}
    27  	return s
    28  }