Documentation ¶
Index ¶
- Variables
- func Execute(options ...HarnessOption)
- func NewBasePathFs(source afero.Fs, path string) afero.Fs
- func WithFilesystem(name string, handler afero.Fs) func(*Harness) error
- func WithHandler(name string, handler http.Handler) func(*Harness) error
- func WithTestFromBytes(name string, xs []byte) func(*Harness) error
- func WithTestFromFs(fs afero.Fs, name string) func(*Harness) error
- func WithTesting(t *testing.T) func(*Harness) error
- func WithTests(name string, xs []Test) func(*Harness) error
- type BasePathFile
- type BasePathFs
- func (b *BasePathFs) Chmod(name string, mode os.FileMode) (err error)
- func (b *BasePathFs) Chown(name string, uid, gid int) (err error)
- func (b *BasePathFs) Chtimes(name string, atime, mtime time.Time) (err error)
- func (b *BasePathFs) Create(name string) (f afero.File, err error)
- func (b *BasePathFs) LstatIfPossible(name string) (os.FileInfo, bool, error)
- func (b *BasePathFs) Mkdir(name string, mode os.FileMode) (err error)
- func (b *BasePathFs) MkdirAll(name string, mode os.FileMode) (err error)
- func (b *BasePathFs) Name() string
- func (b *BasePathFs) Open(name string) (f afero.File, err error)
- func (b *BasePathFs) OpenFile(name string, flag int, mode os.FileMode) (f afero.File, err error)
- func (b *BasePathFs) ReadlinkIfPossible(name string) (string, error)
- func (b *BasePathFs) RealPath(name string) (p string, err error)
- func (b *BasePathFs) Remove(name string) (err error)
- func (b *BasePathFs) RemoveAll(name string) (err error)
- func (b *BasePathFs) Rename(oldname, newname string) (err error)
- func (b *BasePathFs) Stat(name string) (fi os.FileInfo, err error)
- func (b *BasePathFs) SymlinkIfPossible(oldname, newname string) error
- type Comparison
- type Extra
- type Harness
- type HarnessOption
- type Source
- type Test
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrExpressionMustReturnBool = errors.New("cel expression must return bool") ErrUnknownType = errors.New("unknown type") )
Functions ¶
func Execute ¶
func Execute(options ...HarnessOption)
Types ¶
type BasePathFile ¶
func (*BasePathFile) Name ¶
func (f *BasePathFile) Name() string
type BasePathFs ¶
type BasePathFs struct {
// contains filtered or unexported fields
}
This is a version of the afero basepathfs that uses path instead of filepath. this is needed to work with things like zipfs and embedfs on windows
func (*BasePathFs) Chtimes ¶
func (b *BasePathFs) Chtimes(name string, atime, mtime time.Time) (err error)
func (*BasePathFs) LstatIfPossible ¶
func (*BasePathFs) MkdirAll ¶
func (b *BasePathFs) MkdirAll(name string, mode os.FileMode) (err error)
func (*BasePathFs) Name ¶
func (b *BasePathFs) Name() string
func (*BasePathFs) ReadlinkIfPossible ¶
func (b *BasePathFs) ReadlinkIfPossible(name string) (string, error)
func (*BasePathFs) RealPath ¶
func (b *BasePathFs) RealPath(name string) (p string, err error)
on a file outside the base path it returns the given file name and an error, else the given file with the base path prepended
func (*BasePathFs) Remove ¶
func (b *BasePathFs) Remove(name string) (err error)
func (*BasePathFs) RemoveAll ¶
func (b *BasePathFs) RemoveAll(name string) (err error)
func (*BasePathFs) Rename ¶
func (b *BasePathFs) Rename(oldname, newname string) (err error)
func (*BasePathFs) SymlinkIfPossible ¶
func (b *BasePathFs) SymlinkIfPossible(oldname, newname string) error
type Comparison ¶
type Comparison struct { Expr string `json:"expr"` Exprs []string `json:"exprs"` Literal bool `json:"literal"` }
func (*Comparison) Compare ¶
func (c *Comparison) Compare(t *testing.T, aRaw, bRaw json.RawMessage, aCode, bCode int) error
type Extra ¶
type Extra struct { Vars map[string]any `json:"vars"` RawBodyZZZZ json.RawMessage `json:"tests"` }
type HarnessOption ¶
type Source ¶
type Source struct { // remote type Remote *string `json:"remote,omitempty"` Handler *string `json:"handler,omitempty"` Method string `json:"method"` Path string `json:"path"` Query map[string]string `json:"query"` Headers map[string]string `json:"headers"` Body *Source `json:"body,omitempty"` // data type Data any `json:"data,omitempty"` // file type File *string `json:"file,omitempty"` Fs string `json:"fs,omitempty"` // for raw type Raw *string `json:"raw,omitempty"` // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.