summaryrefslogtreecommitdiff
path: root/tests/matrix/dir_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/matrix/dir_test.go')
-rw-r--r--tests/matrix/dir_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/matrix/dir_test.go b/tests/matrix/dir_test.go
index 2f9f1b0..2f7a034 100644
--- a/tests/matrix/dir_test.go
+++ b/tests/matrix/dir_test.go
@@ -3,6 +3,7 @@ package matrix
import (
"fmt"
"os"
+ "os/exec"
"syscall"
"testing"
@@ -48,3 +49,24 @@ func TestRmdirPerms(t *testing.T) {
}
}
}
+
+// TestHaveDotdot checks that we have "." and ".." in a directory.
+// (gocryptfs v2.0-beta1 did not!)
+func TestHaveDotdot(t *testing.T) {
+ dir1 := test_helpers.DefaultPlainDir + "/TestHaveDotdot"
+ err := os.Mkdir(dir1, 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // All Go readdir functions filter out "." and "..".
+ // Fall back to "ls -a" which does not.
+ out, err := exec.Command("ls", "-a", dir1).CombinedOutput()
+ if err != nil {
+ t.Fatal(err)
+ }
+ have := string(out)
+ want := ".\n..\n"
+ if have != want {
+ t.Errorf("have=%q want=%q", have, want)
+ }
+}