MCPcopy Create free account
hub / github.com/diillson/chatcli / TestSplitTopLevelCodeBlocks_SeparatesFences

Function TestSplitTopLevelCodeBlocks_SeparatesFences

cli/cli_rendering_test.go:21–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestSplitTopLevelCodeBlocks_SeparatesFences(t *testing.T) {
22 in := "prosa um\n\n```yaml\nkey: value\n```\n\nprosa dois"
23 segs := splitTopLevelCodeBlocks(in)
24 require.Len(t, segs, 3)
25
26 assert.False(t, segs[0].isCode)
27 assert.Contains(t, segs[0].text, "prosa um")
28
29 assert.True(t, segs[1].isCode)
30 assert.Equal(t, "yaml", segs[1].lang)
31 assert.Contains(t, segs[1].text, "key: value")
32
33 assert.False(t, segs[2].isCode)
34 assert.Contains(t, segs[2].text, "prosa dois")
35}
36
37func TestSplitTopLevelCodeBlocks_IndentedFenceStaysProse(t *testing.T) {
38 // A fence indented under a list item must NOT be split out — keeping it

Callers

nothing calls this directly

Calls 3

splitTopLevelCodeBlocksFunction · 0.85
EqualMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected