You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
585 B
27 lines
585 B
3 years ago
|
package fs
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func Test_GetDir(t *testing.T) {
|
||
|
dirpath := "../testfiles/"
|
||
|
|
||
|
_, err := GetDir(dirpath, false)
|
||
|
if err != nil {
|
||
|
t.Fatalf("GetDir error: %s", err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func Test_GetDirRecursive(t *testing.T) {
|
||
|
dirpath := "../testfiles/"
|
||
|
|
||
|
dir, err := GetDir(dirpath, true)
|
||
|
if err != nil {
|
||
|
t.Fatalf("GetDir error: %s", err)
|
||
|
}
|
||
|
|
||
|
expectedAmountOfUpperDirectories := 2
|
||
|
if len(dir.Directories) != expectedAmountOfUpperDirectories {
|
||
|
t.Fatalf("GetDir error: expected to have %d inner directories; got %d", expectedAmountOfUpperDirectories, len(dir.Directories))
|
||
|
}
|
||
|
}
|