@@ -352,39 +352,50 @@ pub fn repeat_test() {
352
352
}
353
353
354
354
pub fn split_test() {
355
- list.split([], 0)
355
+ []
356
+ |> list.split(_, 0)
356
357
|> expect.equal(_, struct([], []))
357
358
358
- list.split([0, 1, 2, 3, 4], 0)
359
+ [0, 1, 2, 3, 4]
360
+ |> list.split(_, 0)
359
361
|> expect.equal(_, struct([], [0, 1, 2, 3, 4]))
360
362
361
- list.split([0, 1, 2, 3, 4], -2)
363
+ [0, 1, 2, 3, 4]
364
+ |> list.split(_, -2)
362
365
|> expect.equal(_, struct([], [0, 1, 2, 3, 4]))
363
366
364
- list.split([0, 1, 2, 3, 4], 1)
367
+ [0, 1, 2, 3, 4]
368
+ |> list.split(_, 1)
365
369
|> expect.equal(_, struct([0], [1, 2, 3, 4]))
366
370
367
- list.split([0, 1, 2, 3, 4], 3)
371
+ [0, 1, 2, 3, 4]
372
+ |> list.split(_, 3)
368
373
|> expect.equal(_, struct([0, 1, 2], [3, 4]))
369
374
370
- list.split([0, 1, 2, 3, 4], 9)
375
+ [0, 1, 2, 3, 4]
376
+ |> list.split(_, 9)
371
377
|> expect.equal(_, struct([0, 1, 2, 3, 4], []))
372
378
}
373
379
374
380
pub fn split_while_test() {
375
- list.split_while([], fn(x) { x <= 5 })
381
+ []
382
+ |> list.split_while(_, fn(x) { x <= 5 })
376
383
|> expect.equal(_, struct([], []))
377
384
378
- list.split_while([1, 2, 3, 4, 5], fn(x) { x <= 5 })
385
+ [1, 2, 3, 4, 5]
386
+ |> list.split_while(_, fn(x) { x <= 5 })
379
387
|> expect.equal(_, struct([1, 2, 3, 4, 5], []))
380
388
381
- list.split_while([1, 2, 3, 4, 5], fn(x) { x == 2 })
389
+ [1, 2, 3, 4, 5]
390
+ |> list.split_while(_, fn(x) { x == 2 })
382
391
|> expect.equal(_, struct([], [1, 2, 3, 4, 5]))
383
392
384
- list.split_while([1, 2, 3, 4, 5], fn(x) { x <= 3 })
393
+ [1, 2, 3, 4, 5]
394
+ |> list.split_while(_, fn(x) { x <= 3 })
385
395
|> expect.equal(_, struct([1, 2, 3], [4, 5]))
386
396
387
- list.split_while([1, 2, 3, 4, 5], fn(x) { x <= -3 })
397
+ [1, 2, 3, 4, 5]
398
+ |> list.split_while(_, fn(x) { x <= -3 })
388
399
|> expect.equal(_, struct([], [1, 2, 3, 4, 5]))
389
400
}
390
401
0 commit comments