summaryrefslogtreecommitdiff
path: root/extra/tts_test.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-01-10 10:16:10 +0300
committerGrail Finder <wohilas@gmail.com>2026-01-10 10:16:10 +0300
commit8474b87c43650b53aa562a62aaac12d760aa5fc7 (patch)
tree5ea6f1b351d3e5f3ca9648ef2fa04de0dcc4400f /extra/tts_test.go
parent505477b8e388ee351f724e1b389db549bb4ce003 (diff)
Enha: clean text before sending to tts
Diffstat (limited to 'extra/tts_test.go')
-rw-r--r--extra/tts_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/extra/tts_test.go b/extra/tts_test.go
new file mode 100644
index 0000000..a21d9b8
--- /dev/null
+++ b/extra/tts_test.go
@@ -0,0 +1,40 @@
+//go:build extra
+// +build extra
+
+package extra
+
+import (
+ "testing"
+)
+
+func TestCleanText(t *testing.T) {
+ tests := []struct {
+ input string
+ expected string
+ }{
+ {"Hello world", "Hello world"},
+ {"**Bold text**", "Bold text"},
+ {"*Italic text*", "Italic text"},
+ {"# Header", "Header"},
+ {"_Underlined text_", "Underlined text"},
+ {"~Strikethrough text~", "Strikethrough text"},
+ {"`Code text`", "Code text"},
+ {"[Link text](url)", "Link text(url)"},
+ {"Mixed *markdown* and #headers#!", "Mixed markdown and headers"},
+ {"<html>tags</html>", "tags"},
+ {"|---|", ""}, // Table separator
+ {"|====|", ""}, // Table separator with equals
+ {"| - - - |", ""}, // Table separator with spaced dashes
+ {"| cell1 | cell2 |", "cell1 cell2"}, // Table row with content
+ {" Trailing spaces ", "Trailing spaces"},
+ {"", ""},
+ {"***", ""},
+ }
+
+ for _, test := range tests {
+ result := cleanText(test.input)
+ if result != test.expected {
+ t.Errorf("cleanText(%q) = %q; expected %q", test.input, result, test.expected)
+ }
+ }
+} \ No newline at end of file