Codebase list golang-github-gobuffalo-packr / a77a02a7-acb7-4661-b63e-63f13af9648b/upstream v2 / jam / parser / prospect_test.go
a77a02a7-acb7-4661-b63e-63f13af9648b/upstream

Tree @a77a02a7-acb7-4661-b63e-63f13af9648b/upstream (Download .tar.gz)

prospect_test.go @a77a02a7-acb7-4661-b63e-63f13af9648b/upstreamraw · history · blame

package parser

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func Test_IsProspect(t *testing.T) {
	table := []struct {
		path string
		pass bool
	}{
		{"foo/.git/config", false},
		{"foo/.git/baz.go", false},
		{"a.go", true},
		{".", true},
		{"a/b.go", true},
		{"a/b_test.go", false},
		{"a/b-packr.go", false},
		{"a/vendor/b.go", false},
		{"a/_c/c.go", false},
		{"a/_c/e/fe/f/c.go", false},
		{"a/d/_d.go", false},
		{"a/d/", false},
	}

	for _, tt := range table {
		t.Run(tt.path, func(st *testing.T) {
			r := require.New(st)
			if tt.pass {
				r.True(IsProspect(tt.path, ".", "_"))
			} else {
				r.False(IsProspect(tt.path, ".", "_"))
			}
		})
	}
}