diff options
author | xuri <xuri.me@gmail.com> | 2021-12-01 00:10:31 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2021-12-01 00:10:31 +0800 |
commit | bb0eb4a42be2c004a3c2ce59a8c748a9822b5f99 (patch) | |
tree | 6c16befeca4b645e4fb87376e921dbcbd44b4c0d /file_test.go | |
parent | 49c9ea40d7cf7c20e9b94723c84780f4d048f4a4 (diff) |
This closes #1075, reload temporary files into memory on save
Diffstat (limited to 'file_test.go')
-rw-r--r-- | file_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
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) { |