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