File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ type ErrTemplateNotFound struct {
8
8
}
9
9
10
10
func (e ErrTemplateNotFound ) Error () string {
11
- return fmt .Sprintf ("template %s not found" , e .Name )
11
+ return fmt .Sprintf ("template '%s' not found" , e .Name )
12
12
}
13
13
14
14
// ErrTemplateExecution is returned when a template fails to execute.
@@ -18,7 +18,7 @@ type ErrTemplateExecution struct {
18
18
}
19
19
20
20
func (e ErrTemplateExecution ) Error () string {
21
- return fmt .Sprintf ("failed to execute template %s: %v " , e .Name , e .Err )
21
+ return fmt .Sprintf ("failed to execute template '%s': '%v' " , e .Name , e .Err )
22
22
}
23
23
24
24
func (e ErrTemplateExecution ) Unwrap () error {
Original file line number Diff line number Diff line change
1
+ package templator
2
+
3
+ import (
4
+ "errors"
5
+ "testing"
6
+
7
+ "github.com/stretchr/testify/assert"
8
+ )
9
+
10
+ func TestErrTemplateNotFound_Error (t * testing.T ) {
11
+ t .Parallel ()
12
+
13
+ e := ErrTemplateNotFound {Name : "foo" }
14
+
15
+ got := e .Error ()
16
+ assert .Equal (t , "template 'foo' not found" , got )
17
+ }
18
+
19
+ func TestErrTemplateExecution_Error (t * testing.T ) {
20
+ t .Parallel ()
21
+
22
+ e := ErrTemplateExecution {
23
+ Name : "foo" ,
24
+ Err : errors .New ("bar" ),
25
+ }
26
+
27
+ got := e .Error ()
28
+ assert .Equal (t , "failed to execute template 'foo': 'bar'" , got )
29
+ }
Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ func Test_validateField(t *testing.T) {
92
92
93
93
for _ , tc := range testCases {
94
94
t .Run (tc .name , func (t * testing.T ) {
95
+ t .Parallel ()
96
+
95
97
err := validateField (tc .typ , tc .fieldPath )
96
98
97
99
if tc .wantErr {
You can’t perform that action at this time.
0 commit comments