@@ -88,6 +88,43 @@ func Test_validate(t *testing.T) {
88
88
}
89
89
},
90
90
},
91
+ {
92
+ name : "Successful validation template" ,
93
+ args : args {
94
+ config : formatter.Config {
95
+ OutputFormat : formatter .MarkdownOutput ,
96
+ TemplatePath : path .Join (os .TempDir (), "formatter_template_valid" ),
97
+ InputFileConfig : formatter.InputFileConfig {
98
+ Path : path .Join (os .TempDir (), "formatter_cmd_valid_template_3" ),
99
+ },
100
+ },
101
+ },
102
+ wantErr : false ,
103
+ before : func (t * testing.T ) {
104
+ templatePath := path .Join (os .TempDir (), "formatter_template_valid" )
105
+ filePath := path .Join (os .TempDir (), "formatter_cmd_valid_template_3" )
106
+ _ , err := os .Create (templatePath )
107
+ if err != nil {
108
+ t .Errorf ("could not create temporary file: %s" , templatePath )
109
+ }
110
+ _ , err = os .Create (filePath )
111
+ if err != nil {
112
+ t .Errorf ("could not create temporary file: %s" , filePath )
113
+ }
114
+ },
115
+ after : func (t * testing.T ) {
116
+ templatePath := path .Join (os .TempDir (), "formatter_template_valid" )
117
+ filePath := path .Join (os .TempDir (), "formatter_cmd_valid_template_3" )
118
+ err := os .Remove (templatePath )
119
+ if err != nil {
120
+ t .Logf ("could not remove temporary file: %s" , templatePath )
121
+ }
122
+ err = os .Remove (filePath )
123
+ if err != nil {
124
+ t .Logf ("could not remove temporary file: %s" , filePath )
125
+ }
126
+ },
127
+ },
91
128
}
92
129
for _ , tt := range tests {
93
130
t .Run (tt .name , func (t * testing.T ) {
0 commit comments