把 github.com/Autumn-27/norma v0.4.3(commit 320ae32)的源码复制到 third_party/norma,并用 go.mod 的 replace 指向本地副本。上游删除仓库或 改写 tag 都不再影响本仓库构建。 - 已验证 GOPROXY=off 下可完整编译并打出发行包 - go.sum 中该模块的两条校验记录随之删除(本地 replace 不需要哈希) - 升级方法与授权注意事项见 third_party/README.md
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package llm
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestTodoReminderMessageRoundTrip(t *testing.T) {
|
|
m := TodoReminderMessage("1. [in_progress] build\n2. [pending] test")
|
|
if m.Role != RoleUser {
|
|
t.Fatalf("todo reminder must be a user message, got %q", m.Role)
|
|
}
|
|
if !strings.HasPrefix(m.Text(), "<system-reminder>") {
|
|
t.Fatalf("must be wrapped in <system-reminder>: %q", m.Text())
|
|
}
|
|
if !strings.Contains(m.Text(), "build") || !strings.Contains(m.Text(), "test") {
|
|
t.Fatalf("list content missing: %q", m.Text())
|
|
}
|
|
if !IsTodoReminder(m) {
|
|
t.Fatal("IsTodoReminder should detect its own message")
|
|
}
|
|
}
|
|
|
|
func TestIsTodoReminderNoFalsePositive(t *testing.T) {
|
|
// Ordinary user text, a plain system-reminder, and an assistant message must
|
|
// not be mistaken for a todo reminder.
|
|
cases := []Message{
|
|
UserText("please update the todo list"),
|
|
UserText("<system-reminder>\n# currentDate\nToday is 2026-01-01.\n</system-reminder>"),
|
|
{Role: RoleAssistant, Content: []ContentBlock{TextBlock("<system-reminder>...</system-reminder>")}},
|
|
}
|
|
for i, m := range cases {
|
|
if IsTodoReminder(m) {
|
|
t.Fatalf("case %d falsely detected as todo reminder: %q", i, m.Text())
|
|
}
|
|
}
|
|
}
|