github.com/quay/claircore@v1.5.28/pkg/ovalutil/dpkg_test.go (about)

     1  package ovalutil
     2  
     3  import "testing"
     4  
     5  func TestValidVersion(t *testing.T) {
     6  	tt := []struct {
     7  		In    string
     8  		Match bool
     9  	}{
    10  		{
    11  			Match: false,
    12  			In:    "5.7 only",
    13  		},
    14  		{
    15  			Match: false,
    16  			In:    "extremely\nbroken",
    17  		},
    18  		{
    19  			Match: true,
    20  			In:    "10.3+deb10u12",
    21  		},
    22  	}
    23  	for _, tc := range tt {
    24  		ok := validVersion.MatchString(tc.In)
    25  		t.Logf("%#q:\tgot: %v, want: %v", tc.In, ok, tc.Match)
    26  		if tc.Match != ok {
    27  			t.Error()
    28  		}
    29  	}
    30  }