github.com/jxskiss/gopkg/v2@v2.14.9-0.20240514120614-899f3e7952b4/easy/template_test.go (about)

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