github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/x/stringsx/split_to_words_z_unit_test.go (about)

     1  package stringsx_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/onsi/gomega"
     7  
     8  	. "github.com/machinefi/w3bstream/pkg/depends/x/stringsx"
     9  )
    10  
    11  func Test_SplitToWords(t *testing.T) {
    12  	words := []string{"I", "Am", "A", "10", "Years", "Senior"}
    13  	cases := []struct {
    14  		phrase string
    15  		words  []string
    16  	}{
    17  		{"IAmA10YearsSenior", words},
    18  		{"I Am A 10 Years Senior", words},
    19  		{". I_ Am_A_10_Years____Senior__", words},
    20  		{"I-~~ Am\nA\t10 Years *** Senior", words},
    21  		{"lowercase", []string{"lowercase"}},
    22  		{"Class", []string{"Class"}},
    23  		{"MyClass", []string{"My", "Class"}},
    24  		{"HTML", []string{"HTML"}},
    25  		{"QOSType", []string{"QOS", "Type"}},
    26  	}
    27  	for _, c := range cases {
    28  		NewWithT(t).Expect(SplitToWords(c.phrase)).To(Equal(c.words))
    29  	}
    30  }