Beispiel #1
0
func TestDirIn(t *testing.T) {
	Dir(func(parent string) {
		DirIn(parent, func(dir string) {
			assert.True(t, fileExists(dir))
			assert.True(t, strings.HasPrefix(dir, parent))
		})
	})
}
Beispiel #2
0
func TestFileIn(t *testing.T) {
	Dir(func(dir string) {
		FileIn(dir, func(name string) {
			assert.True(t, strings.HasPrefix(name, dir))
			assert.True(t, fileExists(name))
		})
	})
}
Beispiel #3
0
func TestEmptyDir(t *testing.T) {
	var dirname string

	Dir(func(name string) {
		fi, err := os.Stat(name)
		assert.Nil(t, err)
		assert.True(t, fi.Mode().IsDir())

		dirname = name
	})

	assert.False(t, fileExists(dirname))
}
Beispiel #4
0
func TestFile(t *testing.T) {
	var filename string

	File(func(name string) {
		fi, err := os.Stat(name)
		assert.Nil(t, err)
		assert.True(t, fi.Mode().IsRegular())

		filename = name
	})

	assert.False(t, fileExists(filename))
}