@@ -7,12 +7,12 @@ import (
7
7
"testing"
8
8
)
9
9
10
- // Keeps track of files that we've used so we can clean up.
10
+ // Files keeps track of files that we've used so we can clean up.
11
11
var Files []string
12
- var appFs afero. Fs = afero .NewOsFs ()
12
+ var appFs = afero .NewOsFs ()
13
13
14
14
/*
15
- Creates a tmp directory for us to use.
15
+ TmpDir Creates a tmp directory for us to use.
16
16
*/
17
17
func TmpDir (t * testing.T , dir string ) string {
18
18
name , err := afero .TempDir (appFs , dir , "dir" )
@@ -25,7 +25,7 @@ func TmpDir(t *testing.T, dir string) string {
25
25
}
26
26
27
27
/*
28
- Creates a tmp file for us to use when testing
28
+ TmpFile Creates a tmp file for us to use when testing
29
29
*/
30
30
func TmpFile (t * testing.T , dir string , content string ) afero.File {
31
31
file , err := afero .TempFile (appFs , dir , "file" )
@@ -40,7 +40,8 @@ func TmpFile(t *testing.T, dir string, content string) afero.File {
40
40
}
41
41
42
42
/*
43
- Returns true if the file at the path contains the expected byte array content.
43
+ FileSays returns true if the file at the path contains the expected byte array
44
+ content.
44
45
*/
45
46
func FileSays (t * testing.T , path string , expected []byte ) bool {
46
47
content , err := afero .ReadFile (appFs , path )
@@ -52,7 +53,7 @@ func FileSays(t *testing.T, path string, expected []byte) bool {
52
53
}
53
54
54
55
/*
55
- Removes all files in our test registry and calls `t.Error` if something goes
56
+ CleanUp removes all files in our test registry and calls `t.Error` if something goes
56
57
wrong.
57
58
*/
58
59
func CleanUp (t * testing.T ) {
@@ -66,7 +67,7 @@ func CleanUp(t *testing.T) {
66
67
}
67
68
68
69
/*
69
- Returns true if the file exists. Calls t.Error if something goes wrong while
70
+ Exists returns true if the file exists. Calls t.Error if something goes wrong while
70
71
checking.
71
72
*/
72
73
func Exists (t * testing.T , path string ) bool {
@@ -78,8 +79,8 @@ func Exists(t *testing.T, path string) bool {
78
79
}
79
80
80
81
/*
81
- Returns true if the dir contains the path. Calls t.Error if something goes wrong while
82
- checking.
82
+ DirContains returns true if the dir contains the path. Calls t.Error if
83
+ something goes wrong while checking.
83
84
*/
84
85
func DirContains (t * testing.T , dir string , path string ) bool {
85
86
fullPath := filepath .Join (dir , path )
0 commit comments