github.com/jxskiss/gopkg@v0.17.3/easy/template_test.go (about)

     1  package easy
     2  
     3  import (
     4  	"github.com/stretchr/testify/assert"
     5  	"log"
     6  	"testing"
     7  )
     8  
     9  func Test_parseTemplates(t *testing.T) {
    10  	var files []string
    11  	add := func(name string, text []byte) error {
    12  		log.Println("template:", name)
    13  		files = append(files, name)
    14  		return nil
    15  	}
    16  	rootDir := "./"
    17  	rePattern := `.+\.go`
    18  	err := parseTemplates(rootDir, rePattern, add)
    19  	assert.Nil(t, err)
    20  	assert.True(t, len(files) > 0)
    21  }