lextest

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tester

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

func NewTester

func NewTester(t *testing.T, f lexer.StateFn, text string) *Tester

Testing lexers involves some boiler plate. LexTest returns a struct value that can be used to easily test your lexer for correctness.

func (*Tester) End

func (lt *Tester) End() *Tester

Succeeds if the next token is the empty token.

func (*Tester) Error

func (lt *Tester) Error(val string, line int) *Tester

Succeeds if the next token is an error with the given value and line.

func (*Tester) Expect

func (lt *Tester) Expect(typ lexer.TokenType, val string, line int) *Tester

Succeeds if the next token has the given type, value and line. Calls t.Fatalf with an error otherwise.

func (*Tester) Warning

func (lt *Tester) Warning(val string, line int) *Tester

Succeeds if the next token is a warning with the given value and line.

Jump to

Keyboard shortcuts

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