@@ -113,6 +113,7 @@ mod tests {
113
113
} ;
114
114
use arrow:: datatypes:: { Field , Schema , SchemaRef } ;
115
115
use arrow:: util:: pretty:: pretty_format_batches;
116
+ use insta:: assert_snapshot;
116
117
use std:: sync:: Arc ;
117
118
118
119
#[ test]
@@ -180,15 +181,15 @@ mod tests {
180
181
let cols = agg. emit ( ) ?;
181
182
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
182
183
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
183
- let expected = r#"
184
+
185
+ assert_snapshot ! ( actual, @r#"
184
186
+----------+--------------+
185
187
| trace_id | timestamp_ms |
186
188
+----------+--------------+
187
189
| 1 | 1 |
188
190
+----------+--------------+
189
191
"#
190
- . trim ( ) ;
191
- assert_eq ! ( actual, expected) ;
192
+ ) ;
192
193
193
194
Ok ( ( ) )
194
195
}
@@ -205,15 +206,15 @@ mod tests {
205
206
let cols = agg. emit ( ) ?;
206
207
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
207
208
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
208
- let expected = r#"
209
+
210
+ assert_snapshot ! ( actual, @r#"
209
211
+----------+--------------+
210
212
| trace_id | timestamp_ms |
211
213
+----------+--------------+
212
214
| 1 | 1 |
213
215
+----------+--------------+
214
216
"#
215
- . trim ( ) ;
216
- assert_eq ! ( actual, expected) ;
217
+ ) ;
217
218
218
219
Ok ( ( ) )
219
220
}
@@ -230,15 +231,14 @@ mod tests {
230
231
let cols = agg. emit ( ) ?;
231
232
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
232
233
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
233
- let expected = r#"
234
+ assert_snapshot ! ( actual , @ r#"
234
235
+----------+--------------+
235
236
| trace_id | timestamp_ms |
236
237
+----------+--------------+
237
238
| 2 | 2 |
238
239
+----------+--------------+
239
240
"#
240
- . trim ( ) ;
241
- assert_eq ! ( actual, expected) ;
241
+ ) ;
242
242
243
243
Ok ( ( ) )
244
244
}
@@ -255,15 +255,14 @@ mod tests {
255
255
let cols = agg. emit ( ) ?;
256
256
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
257
257
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
258
- let expected = r#"
258
+ assert_snapshot ! ( actual , @ r#"
259
259
+----------+--------------+
260
260
| trace_id | timestamp_ms |
261
261
+----------+--------------+
262
262
| 1 | 1 |
263
263
+----------+--------------+
264
264
"#
265
- . trim ( ) ;
266
- assert_eq ! ( actual, expected) ;
265
+ ) ;
267
266
268
267
Ok ( ( ) )
269
268
}
@@ -280,15 +279,14 @@ mod tests {
280
279
let cols = agg. emit ( ) ?;
281
280
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
282
281
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
283
- let expected = r#"
282
+ assert_snapshot ! ( actual , @ r#"
284
283
+----------+--------------+
285
284
| trace_id | timestamp_ms |
286
285
+----------+--------------+
287
286
| 1 | 2 |
288
287
+----------+--------------+
289
288
"#
290
- . trim ( ) ;
291
- assert_eq ! ( actual, expected) ;
289
+ ) ;
292
290
293
291
Ok ( ( ) )
294
292
}
@@ -305,15 +303,14 @@ mod tests {
305
303
let cols = agg. emit ( ) ?;
306
304
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
307
305
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
308
- let expected = r#"
306
+ assert_snapshot ! ( actual , @ r#"
309
307
+----------+--------------+
310
308
| trace_id | timestamp_ms |
311
309
+----------+--------------+
312
310
| 1 | 1 |
313
311
+----------+--------------+
314
312
"#
315
- . trim ( ) ;
316
- assert_eq ! ( actual, expected) ;
313
+ ) ;
317
314
318
315
Ok ( ( ) )
319
316
}
@@ -330,15 +327,14 @@ mod tests {
330
327
let cols = agg. emit ( ) ?;
331
328
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
332
329
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
333
- let expected = r#"
330
+ assert_snapshot ! ( actual , @ r#"
334
331
+----------+--------------+
335
332
| trace_id | timestamp_ms |
336
333
+----------+--------------+
337
334
| 2 | 2 |
338
335
+----------+--------------+
339
336
"#
340
- . trim ( ) ;
341
- assert_eq ! ( actual, expected) ;
337
+ ) ;
342
338
343
339
Ok ( ( ) )
344
340
}
@@ -355,15 +351,14 @@ mod tests {
355
351
let cols = agg. emit ( ) ?;
356
352
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
357
353
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
358
- let expected = r#"
354
+ assert_snapshot ! ( actual , @ r#"
359
355
+----------+--------------+
360
356
| trace_id | timestamp_ms |
361
357
+----------+--------------+
362
358
| 1 | 1 |
363
359
+----------+--------------+
364
360
"#
365
- . trim ( ) ;
366
- assert_eq ! ( actual, expected) ;
361
+ ) ;
367
362
368
363
Ok ( ( ) )
369
364
}
@@ -380,15 +375,14 @@ mod tests {
380
375
let cols = agg. emit ( ) ?;
381
376
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
382
377
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
383
- let expected = r#"
378
+ assert_snapshot ! ( actual , @ r#"
384
379
+----------+--------------+
385
380
| trace_id | timestamp_ms |
386
381
+----------+--------------+
387
382
| 1 | 2 |
388
383
+----------+--------------+
389
384
"#
390
- . trim ( ) ;
391
- assert_eq ! ( actual, expected) ;
385
+ ) ;
392
386
393
387
Ok ( ( ) )
394
388
}
@@ -406,16 +400,15 @@ mod tests {
406
400
let cols = agg. emit ( ) ?;
407
401
let batch = RecordBatch :: try_new ( test_schema ( ) , cols) ?;
408
402
let actual = format ! ( "{}" , pretty_format_batches( & [ batch] ) ?) ;
409
- let expected = r#"
403
+ assert_snapshot ! ( actual , @ r#"
410
404
+----------+--------------+
411
405
| trace_id | timestamp_ms |
412
406
+----------+--------------+
413
407
| | 3 |
414
408
| 1 | 1 |
415
409
+----------+--------------+
416
410
"#
417
- . trim ( ) ;
418
- assert_eq ! ( actual, expected) ;
411
+ ) ;
419
412
420
413
Ok ( ( ) )
421
414
}
0 commit comments