2019-11-11 02:22:06 +03:00
|
|
|
package here
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Test_nonGoDirRx(t *testing.T) {
|
|
|
|
r := require.New(t)
|
|
|
|
r.False(nonGoDirRx.MatchString(""))
|
|
|
|
r.False(nonGoDirRx.MatchString("hello"))
|
|
|
|
|
|
|
|
table := []string{
|
|
|
|
"go: cannot find main module; see 'go help modules'",
|
|
|
|
"go help modules",
|
|
|
|
"go: ",
|
|
|
|
"build .:",
|
|
|
|
"no Go files",
|
2019-11-14 01:29:41 +03:00
|
|
|
"can't load package: package",
|
2019-11-11 02:22:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
for _, tt := range table {
|
|
|
|
t.Run(tt, func(st *testing.T) {
|
|
|
|
r := require.New(st)
|
|
|
|
|
|
|
|
b := nonGoDirRx.MatchString(tt)
|
|
|
|
r.True(b)
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|