MCPcopy Index your code
hub / github.com/coder/coder / TestSanitizePromptText

Function TestSanitizePromptText

coderd/x/chatd/sanitize_test.go:12–277  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestSanitizePromptText(t *testing.T) {
13 t.Parallel()
14
15 tests := []struct {
16 name string
17 input string
18 want string
19 }{
20 {
21 name: "PlainASCII",
22 input: "Hello, world!",
23 want: "Hello, world!",
24 },
25 {
26 name: "NonLatinChinese",
27 input: "你好世界",
28 want: "你好世界",
29 },
30 {
31 name: "NonLatinArabic",
32 input: "مرحبا بالعالم",
33 want: "مرحبا بالعالم",
34 },
35 {
36 name: "NonLatinHebrew",
37 input: "שלום עולם",
38 want: "שלום עולם",
39 },
40 {
41 name: "StandardEmoji",
42 input: "Great work! 🎉🚀✨",
43 want: "Great work! 🎉🚀✨",
44 },
45 {
46 name: "CodeBlock",
47 input: "```go\nfmt.Println(\"hello\")\n```",
48 want: "```go\nfmt.Println(\"hello\")\n```",
49 },
50 {
51 name: "XMLTags",
52 input: "<system>\nYou are helpful.\n</system>",
53 want: "<system>\nYou are helpful.\n</system>",
54 },
55 {
56 name: "SingleNewlinePreserved",
57 input: "line one\nline two",
58 want: "line one\nline two",
59 },
60 {
61 name: "DoubleNewlinePreserved",
62 input: "paragraph one\n\nparagraph two",
63 want: "paragraph one\n\nparagraph two",
64 },
65 {
66 name: "TripleNewlineCollapsed",
67 input: "above\n\n\nbelow",
68 want: "above\n\nbelow",
69 },

Callers

nothing calls this directly

Calls 3

SanitizePromptTextFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected