@@ -115,57 +115,42 @@ pub fn print_error(error: Error, path: String, test_name: String) -> String {
115
115
] )
116
116
}
117
117
Todo ( message , module , line ) -> {
118
- print_properties (
119
- path ,
120
- [
121
- # ( "test" , test_name ) ,
122
- # ( "error" , "todo" ) ,
123
- # ( "site" , module <> ":" <> int . to_string ( line ) ) ,
124
- # ( "info" , message ) ,
125
- ] ,
126
- )
118
+ print_properties ( path , [
119
+ # ( "test" , test_name ) ,
120
+ # ( "error" , "todo" ) ,
121
+ # ( "site" , module <> ":" <> int . to_string ( line ) ) ,
122
+ # ( "info" , message ) ,
123
+ ] )
127
124
}
128
125
Panic ( message , module , line ) -> {
129
- print_properties (
130
- path ,
131
- [
132
- # ( "test" , test_name ) ,
133
- # ( "error" , "panic" ) ,
134
- # ( "site" , module <> ":" <> int . to_string ( line ) ) ,
135
- # ( "info" , message ) ,
136
- ] ,
137
- )
126
+ print_properties ( path , [
127
+ # ( "test" , test_name ) ,
128
+ # ( "error" , "panic" ) ,
129
+ # ( "site" , module <> ":" <> int . to_string ( line ) ) ,
130
+ # ( "info" , message ) ,
131
+ ] )
138
132
}
139
133
Unmatched ( value , module , line ) -> {
140
- print_properties (
141
- path ,
142
- [
143
- # ( "test" , test_name ) ,
144
- # ( "error" , "Pattern match failed" ) ,
145
- # ( "site" , module <> ":" <> int . to_string ( line ) ) ,
146
- # ( "value" , string . inspect ( value ) ) ,
147
- ] ,
148
- )
134
+ print_properties ( path , [
135
+ # ( "test" , test_name ) ,
136
+ # ( "error" , "Pattern match failed" ) ,
137
+ # ( "site" , module <> ":" <> int . to_string ( line ) ) ,
138
+ # ( "value" , string . inspect ( value ) ) ,
139
+ ] )
149
140
}
150
141
UnmatchedCase ( value ) -> {
151
- print_properties (
152
- path ,
153
- [
154
- # ( "test" , test_name ) ,
155
- # ( "error" , "Pattern match failed" ) ,
156
- # ( "value" , string . inspect ( value ) ) ,
157
- ] ,
158
- )
142
+ print_properties ( path , [
143
+ # ( "test" , test_name ) ,
144
+ # ( "error" , "Pattern match failed" ) ,
145
+ # ( "value" , string . inspect ( value ) ) ,
146
+ ] )
159
147
}
160
148
Crashed ( error ) -> {
161
- print_properties (
162
- path ,
163
- [
164
- # ( "test" , test_name ) ,
165
- # ( "error" , "Program crashed" ) ,
166
- # ( "cause" , string . inspect ( error ) ) ,
167
- ] ,
168
- )
149
+ print_properties ( path , [
150
+ # ( "test" , test_name ) ,
151
+ # ( "error" , "Program crashed" ) ,
152
+ # ( "cause" , string . inspect ( error ) ) ,
153
+ ] )
169
154
}
170
155
}
171
156
}
@@ -221,10 +206,10 @@ fn decode_pattern_match_failed_error(
221
206
let decoder =
222
207
dynamic . decode4 (
223
208
fn ( _ , value , module , line ) { Unmatched ( value , module , line ) } ,
224
- dynamic . field (
225
- atom . create_from_string ( "gleam_error " ) ,
226
- decode_tag ( atom . create_from_string ( "let_assert" ) , _ ) ,
227
- ) ,
209
+ dynamic . field ( atom . create_from_string ( "gleam_error" ) , decode_tag (
210
+ atom . create_from_string ( "let_assert " ) ,
211
+ _ ,
212
+ ) ) ,
228
213
dynamic . field ( atom . create_from_string ( "value" ) , Ok ) ,
229
214
dynamic . field ( atom . create_from_string ( "module" ) , dynamic . string ) ,
230
215
dynamic . field ( atom . create_from_string ( "line" ) , dynamic . int ) ,
@@ -239,10 +224,10 @@ fn decode_todo_error(error: Dynamic) -> Result(Error, dynamic.DecodeErrors) {
239
224
let decoder =
240
225
dynamic . decode4 (
241
226
fn ( _ , message , module , line ) { Todo ( message , module , line ) } ,
242
- dynamic . field (
243
- atom . create_from_string ( "gleam_error " ) ,
244
- decode_tag ( atom . create_from_string ( "todo" ) , _ ) ,
245
- ) ,
227
+ dynamic . field ( atom . create_from_string ( "gleam_error" ) , decode_tag (
228
+ atom . create_from_string ( "todo " ) ,
229
+ _ ,
230
+ ) ) ,
246
231
dynamic . field ( atom . create_from_string ( "message" ) , dynamic . string ) ,
247
232
dynamic . field ( atom . create_from_string ( "module" ) , dynamic . string ) ,
248
233
dynamic . field ( atom . create_from_string ( "line" ) , dynamic . int ) ,
@@ -254,10 +239,10 @@ fn decode_panic_error(error: Dynamic) -> Result(Error, dynamic.DecodeErrors) {
254
239
let decoder =
255
240
dynamic . decode4 (
256
241
fn ( _ , message , module , line ) { Panic ( message , module , line ) } ,
257
- dynamic . field (
258
- atom . create_from_string ( "gleam_error " ) ,
259
- decode_tag ( atom . create_from_string ( "panic" ) , _ ) ,
260
- ) ,
242
+ dynamic . field ( atom . create_from_string ( "gleam_error" ) , decode_tag (
243
+ atom . create_from_string ( "panic " ) ,
244
+ _ ,
245
+ ) ) ,
261
246
dynamic . field ( atom . create_from_string ( "message" ) , dynamic . string ) ,
262
247
dynamic . field ( atom . create_from_string ( "module" ) , dynamic . string ) ,
263
248
dynamic . field ( atom . create_from_string ( "line" ) , dynamic . int ) ,
@@ -359,7 +344,8 @@ pub fn results_to_json(results: List(TestResult)) -> String {
359
344
fn test_result_json ( result : TestResult ) -> Json {
360
345
let fields = case result . error {
361
346
Some ( error ) -> {
362
- let error = print_error ( error , result . the_test . module_path , result . the_test . name )
347
+ let error =
348
+ print_error ( error , result . the_test . module_path , result . the_test . name )
363
349
[ # ( "status" , json . string ( "fail" ) ) , # ( "message" , json . string ( error ) ) ]
364
350
}
365
351
None -> [ # ( "status" , json . string ( "pass" ) ) ]
0 commit comments