MCPcopy Create free account
hub / github.com/Vespa314/cflow / TestCodeParser

Function TestCodeParser

plugin/gomark/parser/code_test.go:12–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestCodeParser(t *testing.T) {
13 tests := []struct {
14 text string
15 code ast.Node
16 }{
17 {
18 text: "`Hello world!",
19 code: nil,
20 },
21 {
22 text: "`Hello world!`",
23 code: &ast.Code{
24 Content: "Hello world!",
25 },
26 },
27 {
28 text: "`Hello \nworld!`",
29 code: nil,
30 },
31 }
32
33 for _, test := range tests {
34 tokens := tokenizer.Tokenize(test.text)
35 node, _ := NewCodeParser().Parse(tokens)
36 require.Equal(t, StringifyNodes([]ast.Node{test.code}), StringifyNodes([]ast.Node{node}))
37 }
38}

Callers

nothing calls this directly

Calls 4

TokenizeFunction · 0.92
NewCodeParserFunction · 0.85
StringifyNodesFunction · 0.85
ParseMethod · 0.65

Tested by

no test coverage detected