init
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestExists(t *testing.T) {
|
||||
tmp, err := ioutil.TempDir("", "fs-test-")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
filename := filepath.Join(tmp, "foo")
|
||||
|
||||
if Exists(filename) {
|
||||
t.Errorf("shouldn't have been able to find non-existant file: %s", filename)
|
||||
}
|
||||
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
t.Errorf("problem opening fresh file (%q): %v", filename, err)
|
||||
}
|
||||
f.Close()
|
||||
|
||||
if !Exists(filename) {
|
||||
t.Errorf("failure to find existant file: %s", filename)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user