github.com/quay/claircore@v1.5.28/java/jar/name_test.go (about)

     1  package jar
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  	"io/fs"
     7  	"os"
     8  	"testing"
     9  
    10  	"github.com/quay/zlog"
    11  )
    12  
    13  func TestCheckName(t *testing.T) {
    14  	t.Parallel()
    15  	ctx := zlog.Test(context.Background(), t)
    16  
    17  	ms, err := fs.Glob(os.DirFS("testdata"), "*/*.jar")
    18  	if err != nil {
    19  		t.Error(err)
    20  	}
    21  	for _, n := range ms {
    22  		i, err := checkName(ctx, n)
    23  		switch {
    24  		case errors.Is(err, nil):
    25  			t.Logf("%s: %+v", n, i)
    26  		case errors.Is(err, errUnpopulated):
    27  			t.Log("expected:", err)
    28  		default:
    29  			t.Error(err)
    30  		}
    31  	}
    32  }