MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / TestSplitString

Function TestSplitString

internal/util/util_test.go:209–345  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

207}
208
209func TestSplitString(t *testing.T) {
210 type args struct {
211 input string
212 width int
213 }
214
215 tests := []struct {
216 name string
217 args args
218 want []string
219 }{
220 {
221 "SplitString",
222 args{
223 `This is a sample sentence to be tested.`,
224 10,
225 },
226 []string{
227 `This is a`,
228 `sample`,
229 `sentence`,
230 `to be`,
231 `tested.`,
232 },
233 },
234 {
235 "SplitString punctuation at eol",
236 args{
237 `Hello alex, this is a test.`,
238 10,
239 },
240 []string{
241 `Hello`,
242 `alex, this`,
243 `is a test.`,
244 },
245 },
246 {
247 "SplitString punctuation at eol 2",
248 args{
249 `Hello alex, this is a test!!!`,
250 10,
251 },
252 []string{
253 `Hello`,
254 `alex, this`,
255 `is a`,
256 `test!!!`,
257 },
258 },
259 {
260 "SplitString long text",
261 args{
262 `As your senses attune to the stillness around, you find yourself engulfed in an impenetrable void, ` +
263 `a realm where darkness reigns supreme. ` +
264 `The abyss seems to stretch infinitely in all directions, ` +
265 `and you feel a chilling isolation seeping into your very bones.`,
266 79,

Callers

nothing calls this directly

Calls 1

SplitStringFunction · 0.85

Tested by

no test coverage detected