MCPcopy Create free account
hub / github.com/CloudyKit/jet / lexerTestCaseCustomLexer

Function lexerTestCaseCustomLexer

lex_test.go:19–37  ·  view source on GitHub ↗
(t *testing.T, lexer *lexer, input string, items ...itemType)

Source from the content-addressed store, hash-verified

17import "testing"
18
19func lexerTestCaseCustomLexer(t *testing.T, lexer *lexer, input string, items ...itemType) {
20 t.Helper()
21 for i := 0; i < len(items); i++ {
22 item := lexer.nextItem()
23
24 for item.typ == itemSpace {
25 item = lexer.nextItem()
26 }
27
28 if item.typ != items[i] {
29 t.Errorf("Unexpected token %s on input on %q => %q", item, input, input[item.pos:])
30 return
31 }
32 }
33 item := lexer.nextItem()
34 if item.typ != itemEOF {
35 t.Errorf("Unexpected token %s, expected EOF", item)
36 }
37}
38
39func lexerTestCase(t *testing.T, input string, items ...itemType) {
40 lexer := lex("test.flowRender", input, true)

Callers 2

lexerTestCaseFunction · 0.85

Calls 1

nextItemMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…