MCPcopy Create free account
hub / github.com/writefreely/writefreely / TestTruncToWord

Function TestTruncToWord

parse/posts_test.go:40–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestTruncToWord(t *testing.T) {
41 text := map[string]string{
42 "Можливо, ми можемо використовувати інтернет-інструменти, щоб виготовити якийсь текст, який би міг бути і на, і в кінцевому підсумку, буде скорочено, тому що це тривало так довго.": "Можливо, ми можемо використовувати інтернет-інструменти, щоб виготовити якийсь",
43 "早安。This is my post. It is great. It is a long post that is great that is a post that is great.": "早安。This is my post. It is great. It is a long post that is great that is a post",
44 "Sup? Everyone says punctuation is punctuation.": "Sup? Everyone says punctuation is punctuation.",
45 "I arrived in Japan six days ago. Tired from a 10-hour flight after a night-long layover in Calgary, I wandered wide-eyed around Narita airport looking for an ATM.": "I arrived in Japan six days ago. Tired from a 10-hour flight after a night-long",
46 }
47
48 c := 1
49 for i, o := range text {
50 if s, _ := TruncToWord(i, 80); s != o {
51 t.Errorf("#%d: Got '%s' from '%s'; expected '%s'", c, s, i, o)
52 }
53 c++
54 }
55}

Callers

nothing calls this directly

Calls 1

TruncToWordFunction · 0.85

Tested by

no test coverage detected