github.com/daixiang0/gci@v0.13.0/pkg/section/prefix_test.go (about)

     1  package section
     2  
     3  // func TestPrefixSpecificity(t *testing.T) {
     4  // 	testCases := []specificityTestData{
     5  // 		{`"foo/pkg/bar"`, Prefix{"", nil, nil}, specificity.MisMatch{}},
     6  // 		{`"foo/pkg/bar"`, Prefix{"foo", nil, nil}, specificity.Match{3}},
     7  // 		{`"foo/pkg/bar"`, Prefix{"bar", nil, nil}, specificity.MisMatch{}},
     8  // 		{`"foo/pkg/bar"`, Prefix{"github.com/foo/bar", nil, nil}, specificity.MisMatch{}},
     9  // 		{`"foo/pkg/bar"`, Prefix{"github.com/foo", nil, nil}, specificity.MisMatch{}},
    10  // 		{`"foo/pkg/bar"`, Prefix{"github.com/bar", nil, nil}, specificity.MisMatch{}},
    11  // 	}
    12  // 	testSpecificity(t, testCases)
    13  // }
    14  
    15  // func TestPrefixParsing(t *testing.T) {
    16  // 	testCases := []sectionTestData{
    17  // 		{"pkgPREFIX", Custom{"", nil, nil}, nil},
    18  // 		{"prefix(test.com)", Custom{"test.com", nil, nil}, nil},
    19  // 	}
    20  // 	testSectionParser(t, testCases)
    21  // }
    22  
    23  // func TestPrefixToString(t *testing.T) {
    24  // 	testSectionToString(t, Custom{})
    25  // 	testSectionToString(t, Custom{"", nil, nil})
    26  // 	testSectionToString(t, Custom{"abc.org", nil, nil})
    27  // 	testSectionToString(t, Custom{"abc.org", nil, CommentLine{"a"}})
    28  // 	testSectionToString(t, Custom{"abc.org", CommentLine{"a"}, NewLine{}})
    29  // }