interptest

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package interptest holds Go functions that the interpreter tests run two times: as compiled code and as interpreted code. Each function takes no argument and returns a value that the test compares.

Index

Constants

View Source
const Limit = 3

Limit is an untyped constant.

View Source
const Scale float64 = 1.5

Scale is a typed constant.

Variables

View Source
var Counter = 10

Counter is a package variable that a sample changes.

Functions

func Arithmetic

func Arithmetic() string

func Assignments added in v0.2.1

func Assignments() string

Assignments gives the order in which an assignment reads its operands: each call adds its name to the log. Go reads the operands of the left side, then the right side, both from left to right, and then stores from left to right.

func Calls

func Calls() string

func Closures

func Closures() string

func Control

func Control() string

func Conversions

func Conversions() string

func Literals

func Literals() string

func Makes added in v0.2.1

func Makes() string

Makes gives the length and the capacity of each slice that make returns, and the sizes that are a panic in Go: a capacity below the length, and a negative size.

func Methods

func Methods() string

func Places added in v0.2.1

func Places() string

Places gives the variable that each store of an assignment changes. Go reads the slice, the map and the pointer of the left side before a store of the same statement gives the name a new value.

func Ranges

func Ranges() string

func Strings

func Strings() string

func Table

func Table() *interp.Table

Table is the symbol table of this package, in the form that the compiler generates for an app: every package-level name, a function for each unexported method, and the exported names of the imports that the samples use.

func Variables

func Variables() string

Types

type Builder

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

Builder collects text, as the node builder of a template does.

func (*Builder) Add

func (b *Builder) Add(parts ...string)

func (*Builder) String

func (b *Builder) String() string

type Item

type Item struct {
	Name  string
	Price int
	Tags  []string
	// contains filtered or unexported fields
}

Item is a row of the samples.

func (Item) Label

func (it Item) Label() string

Label is an exported method with a value receiver.

func (*Item) Raise

func (it *Item) Raise(by int)

Raise is an exported method with a pointer receiver.

type Kind

type Kind string

Kind is a named string type with constants.

const (
	Small Kind = "small"
	Large Kind = "large"
)

type Render

type Render func(Item) string

Render is a named function type, as a slot is.

type Shape

type Shape interface{ Area() int }

Shape is an interface of the samples.

type Square

type Square struct{ Side int }

Square is a Shape.

func (Square) Area

func (s Square) Area() int

type Wrapped added in v0.2.1

type Wrapped struct {
	*Item
	Count int
}

Wrapped reaches the fields of an Item through an embedded pointer.

Jump to

Keyboard shortcuts

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