NewTestDispenser parses input into tokens and creates a new Dispenser for test purposes only; any errors are fatal.
(input string)
| 47 | // NewTestDispenser parses input into tokens and creates a new |
| 48 | // Dispenser for test purposes only; any errors are fatal. |
| 49 | func NewTestDispenser(input string) *Dispenser { |
| 50 | tokens, err := allTokens("Testfile", []byte(input)) |
| 51 | if err != nil && err != io.EOF { |
| 52 | log.Fatalf("getting all tokens from input: %v", err) |
| 53 | } |
| 54 | return NewDispenser(tokens) |
| 55 | } |
| 56 | |
| 57 | // Next loads the next token. Returns true if a token |
| 58 | // was loaded; false otherwise. If false, all tokens |