wip
This commit is contained in:
29
cmd/edit_test.go
Normal file
29
cmd/edit_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestListDir(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
want := []string{}
|
||||
for i := 0; i < 3; i++ {
|
||||
p := path.Join(d, strconv.Itoa(i))
|
||||
ioutil.WriteFile(p, []byte{}, os.ModePerm)
|
||||
want = append(want, p)
|
||||
}
|
||||
os.Mkdir(path.Join(d, "d"), os.ModePerm)
|
||||
|
||||
got, err := listDir(d)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if fmt.Sprint(want) != fmt.Sprint(got) {
|
||||
t.Fatal(want, got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user