tartest

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir

type Dir struct {
	Name string
	UID  int
}

Dir is a tarrable directory representation

func (Dir) Tar

func (d Dir) Tar(tw *tar.Writer) error

Tar tars the Dir

type Extractable

type Extractable interface{}

Extractable is an empty interface for comparing extracted outputs in tests. Using that just to avoid the ugly `interface{}`.

func Extract

func Extract(t *testing.T, r io.Reader) []Extractable

Extract extracts a tarball to a slice of extractables

type File

type File struct {
	Name     string
	UID      int
	Contents *bytes.Buffer
}

File is a tarrable file representation

func (File) Tar

func (f File) Tar(tw *tar.Writer) error

Tar tars the File

type Hardlink struct {
	Name string
	UID  int
}

Hardlink is a representation of a hardlink

func (Hardlink) Tar

func (h Hardlink) Tar(tw *tar.Writer) error

Tar tars the Hardlink

type Tarball

type Tarball []Tarrer

Tarball is a list of tarrables

func (Tarball) Buffer

func (tb Tarball) Buffer() *bytes.Buffer

Buffer returns a byte buffer

func (Tarball) Gzip

func (tb Tarball) Gzip() *bytes.Buffer

Gzip returns a gzipped buffer

type Tarrer

type Tarrer interface {
	Tar(*tar.Writer) error
}

Tarrer is an object that can tar itself to an archive

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL