go-whisper-api/garbage/filter_test.go
admin b5c083e06f
Some checks failed
CodeQL / Analyze (go) (push) Successful in 6m28s
Docker Image / build-docker (push) Failing after 13m26s
Lint and Testing / lint (push) Successful in 11m17s
Lint and Testing / test (push) Successful in 11m17s
Lint and Testing / golangci (push) Successful in 2m40s
first commit
2026-06-04 18:10:52 +07:00

31 lines
797 B
Go

package garbage
import "testing"
func TestFilterText(t *testing.T) {
in := "Привет *выбая* мир *выбая*"
got := FilterText(in, []string{"*выбая*"})
want := "Привет мир"
if got != want {
t.Fatalf("got %q want %q", got, want)
}
}
func TestFilterWords(t *testing.T) {
words := []Word{
{Word: "Что", Start: 0, Stop: 100},
{Word: "*выбая*", Start: 100, Stop: 200},
{Word: "мир", Start: 200, Stop: 300},
}
got := FilterWords(words, []string{"*выбая*"})
if len(got) != 2 || got[1].Word != "мир" {
t.Fatalf("got %+v", got)
}
}
func TestFilterText_emptyPatterns(t *testing.T) {
if got := FilterText("a b", nil); got != "a b" {
t.Fatalf("got %q", got)
}
}