File: flow_control_test.go

package info (click to toggle)
golang-github-masterminds-sprig 3.2.3-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 448 kB
  • sloc: makefile: 10
file content (16 lines) | stat: -rw-r--r-- 279 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package sprig

import (
	"fmt"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestFail(t *testing.T) {
	const msg = "This is an error!"
	tpl := fmt.Sprintf(`{{fail "%s"}}`, msg)
	_, err := runRaw(tpl, nil)
	assert.Error(t, err)
	assert.Contains(t, err.Error(), msg)
}