Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: kuba-- <kuba@sourced.tech>
- Loading branch information
kuba--
committed
Sep 18, 2018
1 parent
b4d81ed
commit e7da41f
Showing
6 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
/coverage.txt | ||
/vendor | ||
Gopkg.lock | ||
Gopkg.toml | ||
go.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module gopkg.in/src-d/go-billy.v4 | ||
|
||
require ( | ||
github.com/kr/pretty v0.1.0 // indirect | ||
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9 | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= | ||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | ||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9 h1:lkiLiLBHGoH3XnqSLUIaBsilGMUjI+Uy2Xu2JLUtTas= | ||
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package util_test | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"regexp" | ||
"testing" | ||
|
||
"gopkg.in/src-d/go-billy.v4/memfs" | ||
"gopkg.in/src-d/go-billy.v4/util" | ||
) | ||
|
||
func TestTempFile(t *testing.T) { | ||
fs := memfs.New() | ||
|
||
dir, err := util.TempDir(fs, "", "util_test") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
defer util.RemoveAll(fs, dir) | ||
|
||
f, err := util.TempFile(fs, dir, "foo") | ||
if f == nil || err != nil { | ||
t.Errorf("TempFile(%q, `foo`) = %v, %v", dir, f, err) | ||
} | ||
} | ||
|
||
func TestTempDir(t *testing.T) { | ||
fs := memfs.New() | ||
|
||
dir := os.TempDir() | ||
name, err := util.TempDir(fs, dir, "util_test") | ||
if name == "" || err != nil { | ||
t.Errorf("TempDir(dir, `util_test`) = %v, %v", name, err) | ||
} | ||
if name != "" { | ||
util.RemoveAll(fs, name) | ||
re := regexp.MustCompile("^" + regexp.QuoteMeta(filepath.Join(dir, "util_test")) + "[0-9]+$") | ||
if !re.MatchString(name) { | ||
t.Errorf("TempDir(`"+dir+"`, `util_test`) created bad name %s", name) | ||
} | ||
} | ||
} |