| 1 | package agent |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestPreviewProseDropsLeadingFileRefs(t *testing.T) { |
| 6 | for _, tc := range []struct{ in, want string }{ |
| 7 | {"@src/App.tsx 帮我把这个组件拆一下", "帮我把这个组件拆一下"}, |
| 8 | {"@a.ts @b.ts fix the imports", "fix the imports"}, |
| 9 | {" @src/App.tsx\tcheck this", "check this"}, |
| 10 | {"@__reasonix_external_folder/mock/notes/ summarise", "summarise"}, |
| 11 | {"no refs here", "no refs here"}, |
| 12 | {"look at @src/App.tsx", "look at @src/App.tsx"}, |
| 13 | } { |
| 14 | if got := previewProse(tc.in); got != tc.want { |
| 15 | t.Errorf("previewProse(%q) = %q, want %q", tc.in, got, tc.want) |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | func TestPreviewProseKeepsRefOnlyPrompts(t *testing.T) { |
| 21 | for _, in := range []string{"@src/App.tsx", "@a.ts @b.ts", "@a.ts "} { |
| 22 | if got := previewProse(in); got != in { |
| 23 | t.Errorf("previewProse(%q) = %q, want it unchanged", in, got) |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 |