(t *testing.T)
| 1992 | } |
| 1993 | |
| 1994 | func 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 | |
| 2011 | func TestCliArgContainsFlag(t *testing.T) { |
| 2012 | tests := []struct { |
nothing calls this directly
no test coverage detected