now with less printlns and more tests

This commit is contained in:
Mark Bates 2019-11-10 18:27:57 -05:00
parent 812232aaff
commit 794943f042
5 changed files with 13 additions and 7 deletions

View File

@ -17,7 +17,7 @@ build: tidy
make tidy make tidy
test: tidy test: tidy
$(GO_BIN) test -cover -tags ${TAGS} -timeout 5s ./... $(GO_BIN) test -count 1 -cover -tags ${TAGS} -timeout 10s ./...
make tidy make tidy
cov: cov:

View File

@ -2,7 +2,6 @@ package here
import ( import (
"encoding/json" "encoding/json"
"fmt"
"os" "os"
"path/filepath" "path/filepath"
) )
@ -93,9 +92,9 @@ func dir(p string) (Info, error) {
} }
func fromNonGoDir(dir string) (Info, error) { func fromNonGoDir(dir string) (Info, error) {
fmt.Println(">>>TODO here/dir.go:59: dir ", dir)
i := Info{ i := Info{
Dir: dir, Dir: dir,
Name: filepath.Base(dir),
} }
b, err := run("go", "list", "-json", "-m") b, err := run("go", "list", "-json", "-m")

View File

@ -49,13 +49,18 @@ func Test_Dir(t *testing.T) {
t.Run(tt.in, func(st *testing.T) { t.Run(tt.in, func(st *testing.T) {
r := require.New(st) r := require.New(st)
_, err = here.Dir(tt.in) info, err := here.Dir(tt.in)
if tt.err { if tt.err {
r.Error(err) r.Error(err)
return return
} }
r.NoError(err) r.NoError(err)
r.NotZero(info)
r.NotZero(info.Dir)
r.NotZero(info.Name)
r.NotZero(info.Module)
}) })
} }
} }

View File

@ -17,7 +17,6 @@ type Ref struct {
} }
func NewRef() (*Ref, error) { func NewRef() (*Ref, error) {
here.ClearCache()
her, err := here.Package("github.com/markbates/pkger") her, err := here.Package("github.com/markbates/pkger")
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -2,6 +2,9 @@ module app
go 1.13 go 1.13
require github.com/markbates/pkger v0.0.0 require (
github.com/gobuffalo/buffalo v0.15.0 // indirect
github.com/markbates/pkger v0.0.0
)
replace github.com/markbates/pkger => ../../../../ replace github.com/markbates/pkger => ../../../../