gopkg.in/easygen.v4@v4.1.0/example0_test.go (about)

     1  package easygen_test
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/go-easygen/easygen"
     7  	"github.com/go-easygen/easygen/egCal"
     8  	"github.com/go-easygen/easygen/egVar"
     9  )
    10  
    11  // for standalone test, change package to `main` and the next func def to,
    12  // func main() {
    13  func ExampleProcess0() {
    14  	tmpl0 := easygen.NewTemplate().Customize()
    15  	tmpl := tmpl0.Funcs(easygen.FuncDefs()).Funcs(egVar.FuncDefs()).Funcs(egCal.FuncDefs())
    16  	easygen.Process0(tmpl, os.Stdout,
    17  		"{{.Name}}: {{clk2uc .Name}} {{clk2ss .Name}}\n"+
    18  			"Cal: {{add 2 3}}, {{multiply 2 3}}, {{subtract 9 2}}, {{divide 24 3}}\n",
    19  		"test/var0")
    20  
    21  	// Output:
    22  	// some-init-method: SomeInitMethod SOME_INIT_METHOD
    23  	// Cal: 5, 6, 7, 8
    24  }
    25  
    26  // To show the full code in GoDoc
    27  type dummy0 struct {
    28  }