aboutsummaryrefslogtreecommitdiff
path: root/tests/defaults/main_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/defaults/main_test.go')
-rw-r--r--tests/defaults/main_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
index 43019ba..0f31a72 100644
--- a/tests/defaults/main_test.go
+++ b/tests/defaults/main_test.go
@@ -14,6 +14,8 @@ import (
"syscall"
"testing"
+ "golang.org/x/sys/unix"
+
"github.com/rfjakob/gocryptfs/v2/tests/test_helpers"
)
@@ -267,15 +269,15 @@ func TestCpWarnings(t *testing.T) {
}
}
-// TestSeekData tests that fs.FileLseeker is implemented
+// TestSeekData tests that SEEK_DATA works
func TestSeekData(t *testing.T) {
fn := filepath.Join(test_helpers.DefaultPlainDir, t.Name())
f, err := os.Create(fn)
if err != nil {
t.Fatal(err)
}
- var oneTiB int64 = 1024 * 1024 * 1024 * 1024
- if _, err = f.Seek(oneTiB, 0); err != nil {
+ var dataOffset int64 = 1024 * 1024 * 1024 // 1 GiB
+ if _, err = f.Seek(dataOffset, 0); err != nil {
t.Fatal(err)
}
if _, err = f.Write([]byte("foo")); err != nil {
@@ -283,18 +285,16 @@ func TestSeekData(t *testing.T) {
}
f.Close()
- const SEEK_DATA = 3
-
f, err = os.Open(fn)
if err != nil {
t.Fatal(err)
}
- off, err := f.Seek(1024*1024, SEEK_DATA)
+ off, err := f.Seek(1024*1024, unix.SEEK_DATA)
if err != nil {
t.Fatal(err)
}
- if off < oneTiB-1024*1024 {
- t.Errorf("off=%d, expected=%d\n", off, oneTiB)
+ if off < dataOffset-1024*1024 {
+ t.Errorf("off=%d, expected=%d\n", off, dataOffset)
}
f.Close()
}