15 lines
317 B
Go
15 lines
317 B
Go
package jsh
|
|
|
|
import "testing"
|
|
|
|
func TestFieldsN(t *testing.T) {
|
|
testString := "Potatoes are the best strings for testing."
|
|
for i := 1; i <= 10; i++ {
|
|
fields := FieldsN(testString, i)
|
|
fieldsLength := len(fields)
|
|
if fieldsLength > i {
|
|
t.Errorf("Expected at most %d fields, got %d", i, fieldsLength)
|
|
}
|
|
}
|
|
}
|