mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-10-28 01:03:50 +08:00
spawn_task 标题 20s 超时且父 ctx 取消不建任务;清洗循环剥前缀内外引号; 异步标题拒绝「新对话」并用条件更新防手改竞态;会话 profile 失败回退全局。
26 lines
711 B
Go
26 lines
711 B
Go
package server
|
|
|
|
import "testing"
|
|
|
|
func TestAutoTitleMayReplace(t *testing.T) {
|
|
for _, current := range []string{"", "新对话", "首条消息预览"} {
|
|
if !autoTitleMayReplace(current, "首条消息预览") {
|
|
t.Fatalf("expected %q to be replaceable", current)
|
|
}
|
|
}
|
|
if autoTitleMayReplace("用户手动改的标题", "首条消息预览") {
|
|
t.Fatal("manual title must not be overwritten")
|
|
}
|
|
}
|
|
|
|
func TestAutoTitleIsUsable(t *testing.T) {
|
|
for _, generated := range []string{"", "新对话"} {
|
|
if autoTitleIsUsable(generated) {
|
|
t.Fatalf("placeholder title %q must be rejected", generated)
|
|
}
|
|
}
|
|
if !autoTitleIsUsable("整理项目设置") {
|
|
t.Fatal("generated title should be accepted")
|
|
}
|
|
}
|