From bb0eb4a42be2c004a3c2ce59a8c748a9822b5f99 Mon Sep 17 00:00:00 2001 From: xuri Date: Wed, 1 Dec 2021 00:10:31 +0800 Subject: This closes #1075, reload temporary files into memory on save --- file_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'file_test.go') diff --git a/file_test.go b/file_test.go index ee5d322..8e65c5d 100644 --- a/file_test.go +++ b/file_test.go @@ -62,6 +62,15 @@ func TestWriteTo(t *testing.T) { _, err := f.WriteTo(bufio.NewWriter(&buf)) assert.Nil(t, err) } + // Test write with temporary file + { + f, buf := File{tempFiles: sync.Map{}}, bytes.Buffer{} + const maxUint16 = 1<<16 - 1 + f.tempFiles.Store("s", "") + f.tempFiles.Store(strings.Repeat("s", maxUint16+1), "") + _, err := f.WriteTo(bufio.NewWriter(&buf)) + assert.EqualError(t, err, "zip: FileHeader.Name too long") + } } func TestClose(t *testing.T) { -- cgit v1.2.1