package channelbridge
import (
"strings"
"testing"
)
func TestStripNarration_RemovesActionBlock(t *testing.T) {
t.Parallel()
in := "
你好呀
\n今天天气不错
" got := stripNarration(in) // Paragraph markers flattened to newlines; narration block dropped entirely. if got != "你好呀\n今天天气不错" { t.Errorf("stripNarration = %q, want %q", got, "你好呀\n今天天气不错") } } func TestStripNarration_PureChatKept(t *testing.T) { t.Parallel() in := "就是普通一句话,没有动作。\n第二行。" if got := stripNarration(in); got != in { t.Errorf("stripNarration changed plain text: %q -> %q", in, got) } } func TestStripNarration_OnlyActionBecomesEmpty(t *testing.T) { t.Parallel() in := "晚上好呀,亲爱的♪
怎么突然这么问,是想我了吗?
" got := splitBubbles(in) if len(got) != 2 || got[0] != "晚上好呀,亲爱的♪" || got[1] != "怎么突然这么问,是想我了吗?" { t.Errorf("splitBubbles = %#v", got) } } func TestSplitBubbles_StripsRoleplayAndDropsEmpty(t *testing.T) { t.Parallel() in := "❤
" got := splitBubbles(in) if len(got) != 2 || got[0] != "当然看得到呀。" { t.Errorf("splitBubbles = %#v", got) } if got[1] != "❤" { t.Errorf("splitBubbles[1] = %q, want ❤", got[1]) } } func TestSplitBubbles_NoParagraphIsSingleBubble(t *testing.T) { t.Parallel() in := "就是普通一句话\n带个换行。" got := splitBubbles(in) if len(got) != 1 || got[0] != in { t.Errorf("splitBubbles = %#v", got) } } func TestSplitBubbles_OnlyActionIsEmpty(t *testing.T) { t.Parallel() if got := splitBubbles("