// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package zip
import (
"bytes"
"encoding/binary"
"encoding/hex"
"internal/obscuretestdata"
"io"
"io/fs"
"os"
"path/filepath"
"reflect"
"regexp"
"strings"
"testing"
"testing/fstest"
"time"
)
type ZipTest struct {
Name string
Source func() (r io.ReaderAt, size int64) // if non-nil, used instead of testdata/<Name> file
Comment string
File []ZipTestFile
Obscured bool // needed for Apple notarization (golang.org/issue/34986)
Error error // the error that Opening this file should return
}
type ZipTestFile struct {
Name string
Mode fs.FileMode
NonUTF8 bool
ModTime time.Time
Modified time.Time
// Information describing expected zip file content.
// First, reading the entire content should produce the error ContentErr.
// Second, if ContentErr==nil, the content should match Content.
// If content is large, an alternative to setting Content is to set File,
// which names a file in the testdata/ directory containing the
// uncompressed expected content.
// If content is very large, an alternative to setting Content or File
// is to set Size, which will then be checked against the header-reported size
// but will bypass the decompressing of the actual data.
// This last option is used for testing very large (multi-GB) compressed files.
ContentErr error
Content []byte
File string
Size uint64
}
var tests = []