Commit e0f7bac7

e0f7bac7c300Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 12 files · +2 added · ~2 modified · -8 deleted

Description

test: collapse Array set-operator and inject/reduce duplicates

array_amp / array_minus / array_pipe were three near-identical tests covering Array#&, Array#-, Array#|. Each had the same shape: 4 typed-array branches + variable-receiver + chained. Collapse into one array_set_ops.rb. (Element semantics live in the existing array_intersection / array_difference / array_union files; these three files were only the operator-dispatch path.)

int_array_inject and int_array_reduce shared the entire body verbatim except for the method name. Merge into int_array_reduce.rb covering both entry points so a divergence at either surfaces.

Net: 5 .rb files → 2. ~3.6s saved on Windows test step at the ~1.2s/test rate measured under the bundling experiment.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

Details

Commit
e0f7bac7c300
Parent
b41ab26f6304

test/array_amp.rbdeleted

1-# Array#& dispatches to the typed-array intersect helpers.
2-# Element semantics are covered in test/array_intersection.rb;
3-# this test only exercises the operator dispatch path.
4-
5-# Each typed-array branch.
6-puts ([1, 2, 3, 4] & [3, 4, 5]).inspect
7-puts (["a", "b", "c"] & ["b", "c"]).inspect
8-puts ([1.0, 2.0, 3.0] & [2.0, 3.0]).inspect
9-puts ([:a, :b, :c] & [:b, :c]).inspect
10-
11-# Variable receiver: literal operands take a different path.
12-a = [1, 2, 3, 4]
13-puts (a & [3, 4, 5]).inspect
14-
15-# Chained: the left `&` must be inferred as int_array.
16-puts ([1, 2, 3, 4] & [2, 3, 4] & [3, 4]).inspect