package app import "testing" func TestAfterThinking(t *testing.T) { cases := []struct{ name, in, want string }{ {"no tag is unchanged", "## Answer\n\nPlain text [1].", "## Answer\n\nPlain text [1]."}, {"reasoning tail is dropped", "Let me write a clear, grounded answer.\n\n\n## Answer\n\nText [1].", "## Answer\n\nText [1]."}, {"last close tag wins", "a b\n\n## Answer", "## Answer"}, {"only reasoning leaves nothing", "still thinking\n\n", ""}, } for _, c := range cases { if got := afterThinking(c.in); got != c.want { t.Errorf("%s: got %q, want %q", c.name, got, c.want) } } if err := usableSummary(afterThinking("still thinking\n")); err == nil { t.Error("a reply that is only reasoning should be rejected as empty") } }