aboutsummaryrefslogtreecommitdiff
path: root/integration_tests/main_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integration_tests/main_test.go')
-rw-r--r--integration_tests/main_test.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/integration_tests/main_test.go b/integration_tests/main_test.go
index 03b26f9..6ac03e1 100644
--- a/integration_tests/main_test.go
+++ b/integration_tests/main_test.go
@@ -3,6 +3,7 @@ package integration_tests
// File reading, writing, modification, truncate
import (
+ "syscall"
"bytes"
"crypto/md5"
"encoding/hex"
@@ -350,3 +351,50 @@ func TestDirOverwrite(t *testing.T) {
t.Fatal(err)
}
}
+
+func TestLongNames(t *testing.T) {
+ // Create
+ wd := defaultPlainDir
+ n255x := string(bytes.Repeat([]byte("x"), 255))
+ f, err := os.Create(wd+n255x)
+ if err != nil {
+ t.Fatalf("Could not create n255x")
+ }
+ f.Close()
+ if !verifyExistence(wd+n255x) {
+ t.Errorf("n255x is not in directory listing")
+ }
+ // Rename long to long
+ n255y := string(bytes.Repeat([]byte("y"), 255))
+ err = os.Rename(wd+n255x, wd+n255y)
+ if err != nil {
+ t.Fatalf("Could not rename n255x to n255y")
+ }
+ if !verifyExistence(wd+n255y) {
+ t.Errorf("n255y is not in directory listing")
+ }
+ // Rename long to short
+ err = os.Rename(wd+n255y, wd+"short")
+ if err != nil {
+ t.Fatalf("Could not rename n255y to short")
+ }
+ if !verifyExistence(wd+"short") {
+ t.Errorf("short is not in directory listing")
+ }
+ // Rename short to long
+ err = os.Rename(wd+"short", wd+n255x)
+ if err != nil {
+ t.Fatalf("Could not rename short to n255x")
+ }
+ if !verifyExistence(wd+n255x) {
+ t.Errorf("255x is not in directory listing II")
+ }
+ // Unlink
+ err = syscall.Unlink(wd+n255x)
+ if err != nil {
+ t.Fatalf("Could not unlink n255x")
+ }
+ if verifyExistence(wd+n255x) {
+ t.Errorf("n255x still there after unlink")
+ }
+}