parsertest

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expect

func Expect(t *testing.T, pkg *ast.Package, expected string)

Expect asserts a Go+ package AST equals output or not.

func Fprint

func Fprint(w io.Writer, pkg *ast.Package)

Fprint prints a Go+ package.

func FprintNode

func FprintNode(w io.Writer, lead string, v interface{}, prefix, indent string)

FprintNode prints a Go+ AST node.

Types

type MemFS

type MemFS struct {
	// contains filtered or unexported fields
}

MemFS represents a file system in memory.

func NewMemFS

func NewMemFS(dirs map[string][]string, files map[string]string) *MemFS

NewMemFS creates a MemFS instance.

func NewSingleFileFS

func NewSingleFileFS(dir string, fname string, data string) *MemFS

NewSingleFileFS creates a file system that only contains a single file.

func (*MemFS) Join

func (p *MemFS) Join(elem ...string) string

Join joins any number of path elements into a single path, separating them with slashes. Empty elements are ignored. The result is Cleaned. However, if the argument list is empty or all its elements are empty, Join returns an empty string.

func (*MemFS) ReadDir

func (p *MemFS) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.

func (*MemFS) ReadFile

func (p *MemFS) ReadFile(filename string) ([]byte, error)

ReadFile reads the file named by filename and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.

Jump to

Keyboard shortcuts

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