Add test for sha256sum function

This commit is contained in:
Tianon Gravi 2024-01-22 09:46:30 -08:00
parent bc4c23b04c
commit b9a5bd8a9c
1 changed files with 14 additions and 0 deletions

View File

@ -219,3 +219,17 @@ func Example_getenv() {
// BAZ: foobar
// FOOBARBAZ
}
func Example_sha256sum() {
tmpl, err := template.New("sha256sum").Funcs(templatelib.FuncMap).Parse(`
{{- "Hello World!" | sha256sum -}}
`)
err = tmpl.Execute(os.Stdout, nil)
if err != nil {
panic(err)
}
// Output:
// 7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069
}