MCPcopy
hub / github.com/urfave/cli / TestTemplateError

Function TestTemplateError

help_test.go:1994–2009  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1992}
1993
1994func TestTemplateError(t *testing.T) {
1995 oldew := ErrWriter
1996 defer func() { ErrWriter = oldew }()
1997
1998 var buf bytes.Buffer
1999 ErrWriter = &buf
2000 err := errors.New("some error")
2001
2002 handleTemplateError(err)
2003 assert.Equal(t, []byte(nil), buf.Bytes())
2004
2005 t.Setenv("CLI_TEMPLATE_ERROR_DEBUG", "true")
2006 handleTemplateError(err)
2007 assert.Contains(t, buf.String(), "CLI TEMPLATE ERROR")
2008 assert.Contains(t, buf.String(), err.Error())
2009}
2010
2011func TestCliArgContainsFlag(t *testing.T) {
2012 tests := []struct {

Callers

nothing calls this directly

Calls 3

handleTemplateErrorFunction · 0.85
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected