tests: matrix: split out directory tests into their own file
matrix_test.go is already too big.
This commit is contained in:
parent
3d6b2685fb
commit
fab585ec01
32
tests/matrix/dir_test.go
Normal file
32
tests/matrix/dir_test.go
Normal file
@ -0,0 +1,32 @@
|
||||
package matrix
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/rfjakob/gocryptfs/tests/test_helpers"
|
||||
)
|
||||
|
||||
// Test Mkdir and Rmdir
|
||||
func TestMkdirRmdir(t *testing.T) {
|
||||
test_helpers.TestMkdirRmdir(t, test_helpers.DefaultPlainDir)
|
||||
}
|
||||
|
||||
// Overwrite an empty directory with another directory
|
||||
func TestDirOverwrite(t *testing.T) {
|
||||
dir1 := test_helpers.DefaultPlainDir + "/DirOverwrite1"
|
||||
dir2 := test_helpers.DefaultPlainDir + "/DirOverwrite2"
|
||||
err := os.Mkdir(dir1, 0777)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = os.Mkdir(dir2, 0777)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = syscall.Rename(dir1, dir2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
@ -372,34 +372,11 @@ func TestFilenameEncryption(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test Mkdir and Rmdir
|
||||
func testMkdirRmdir(t *testing.T) {
|
||||
test_helpers.TestMkdirRmdir(t, test_helpers.DefaultPlainDir)
|
||||
}
|
||||
|
||||
// Test Rename
|
||||
func testRename(t *testing.T) {
|
||||
func TestRename(t *testing.T) {
|
||||
test_helpers.TestRename(t, test_helpers.DefaultPlainDir)
|
||||
}
|
||||
|
||||
// Overwrite an empty directory with another directory
|
||||
func TestDirOverwrite(t *testing.T) {
|
||||
dir1 := test_helpers.DefaultPlainDir + "/DirOverwrite1"
|
||||
dir2 := test_helpers.DefaultPlainDir + "/DirOverwrite2"
|
||||
err := os.Mkdir(dir1, 0777)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = os.Mkdir(dir2, 0777)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = syscall.Rename(dir1, dir2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLongNames(t *testing.T) {
|
||||
fi, err := ioutil.ReadDir(test_helpers.DefaultCipherDir)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user