File: example_test.go

package info (click to toggle)
easygen 5.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 848 kB
  • sloc: sh: 14; makefile: 13
file content (30 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package egVar_test

import (
	"os"

	"github.com/go-easygen/easygen"
	"github.com/go-easygen/easygen/egVar"
)

// for standalone test, change package to `main` and the next func def to,
// func main() {
func Example() {
	// Equivalent testing on commandline:
	//   easygen test/listfunc2

	tmpl0 := egVar.NewTemplate().Customize()
	tmpl := tmpl0.Funcs(easygen.FuncDefs()).Funcs(egVar.FuncDefs())
	err := easygen.Process(tmpl, os.Stdout, "../test/listfunc2")

	// Output:
	// some-init-method 5 5 someInitMethod SomeInitMethod

	if err != nil {
		panic(err)
	}
}

// To show the full code in GoDoc
type dummy struct {
}