(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func 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 | } |
nothing calls this directly
no test coverage detected