返回 DeepSeek-Reasonix
title_test.go
根目录 / internal / agent / title_test.go
1 package agent
2
3 import (
4 "testing"
5
6 "reasonix/internal/provider"
7 )
8
9 func TestReasoningLanguageDirectiveIsNotUserAuthored(t *testing.T) {
10 for _, injected := range []string{
11 "<reasoning-language>\nUse Simplified Chinese",
12 "<reasoning-language>\nUse Simplified Chinese\n</reasoning-language>",
13 } {
14 if IsUserAuthoredTurnMessage(provider.Message{Role: provider.RoleUser, Content: injected}) {
15 t.Fatalf("reasoning-language directive %q must not count as user-authored", injected)
16 }
17 }
18 }
19
20 func TestStripPasteDisplayLabel(t *testing.T) {
21 tests := []struct {
22 name string
23 in string
24 want string
25 }{
26 {name: "simplified Chinese", in: "[已粘贴文本 #1 · 100 行]\npackage main", want: "package main"},
27 {name: "traditional Chinese", in: "[已貼上文字 #2 · 5 行]\r\n帮我看看这段代码", want: "帮我看看这段代码"},
28 {name: "English", in: "[Pasted text #3 · 42 lines]\nfunc foo() {}", want: "func foo() {}"},
29 {name: "inline mention", in: "Explain [Pasted text #1 · 2 lines] handling", want: "Explain [Pasted text #1 · 2 lines] handling"},
30 {name: "later standalone line", in: "Keep this\n[Pasted text #1 · 2 lines]\nverbatim", want: "Keep this\n[Pasted text #1 · 2 lines]\nverbatim"},
31 {name: "no label", in: "debug the login issue", want: "debug the login issue"},
32 }
33 for _, tt := range tests {
34 t.Run(tt.name, func(t *testing.T) {
35 if got := StripPasteDisplayLabel(tt.in); got != tt.want {
36 t.Fatalf("StripPasteDisplayLabel(%q) = %q, want %q", tt.in, got, tt.want)
37 }
38 })
39 }
40 }
41
41 lines GO