Esempio n. 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))
		})
	})
}
Esempio n. 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))
		})
	})
}
Esempio n. 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))
}
Esempio n. 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))
}