|
| 1 | +// should allow `a:=arr.sorted(a < b)` use `a` as var name |
| 2 | +fn test_skip_check_sort_arg_a_b() { |
| 3 | + arr := [4, 2, 1, 3] |
| 4 | + a := arr.sorted(a < b) |
| 5 | + assert a == [1, 2, 3, 4] |
| 6 | + b := arr.sorted(a > b) |
| 7 | + assert b == [4, 3, 2, 1] |
| 8 | +} |
| 9 | + |
| 10 | +// should allow `it:=arr.map(it*2)` use `it` as var name |
| 11 | +fn test_skip_check_map_arg_it() { |
| 12 | + it := [4, 2, 1, 3].map(it * 2) |
| 13 | + assert it == [8, 4, 2, 6] |
| 14 | +} |
| 15 | + |
| 16 | +// should allow `it:=arr.filter(it%2==0)` use `it` as var name |
| 17 | +fn test_skip_check_filter_arg_it() { |
| 18 | + it := [4, 2, 1, 3].filter(it % 2 == 0) |
| 19 | + assert it == [4, 2] |
| 20 | +} |
| 21 | + |
| 22 | +// should allow `it:=arr.any(it%2==0)` use `it` as var name |
| 23 | +fn test_skip_check_any_arg_it() { |
| 24 | + it := [4, 2, 1, 3].any(it % 2 == 0) |
| 25 | + assert it |
| 26 | +} |
| 27 | + |
| 28 | +// should allow `it:=arr.all(it%2==0)` use `it` as var name |
| 29 | +fn test_skip_check_all_arg_it() { |
| 30 | + it := [4, 2, 1, 3].all(it % 2 == 0) |
| 31 | + assert !it |
| 32 | +} |
| 33 | + |
| 34 | +// should allow `it:=arr.count(it%2==0)` use `it` as var name |
| 35 | +fn test_skip_check_count_arg_it() { |
| 36 | + it := [4, 2, 1, 3].count(it % 2 == 0) |
| 37 | + assert it == 2 |
| 38 | +} |
0 commit comments