Commit ba658047
ba65804740deMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 18 files · +2 added · -16 deleted
Description
test: bundle 8 def-bearing standalone tests into bundle_misc_c_37
Fold kw_nil_default_string_call, optional_string_param_method,
poly_box_int_array, poly_or_returns_value, each_with_object_seed_
shadow, fetch_nil_default_int_lv, no_keywords_param, sym_case into
a single bundle. Each test's top-level method gets a per-test name
prefix (show -> t_kw_show, parse -> t_osp_parse, etc.) so
they don't collide across tests; the per-test driver function calls
the prefixed name and the bundle invokes the driver.
Tests: default 441/0/0 (was 448, -8 standalone + the bundle).
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- ba65804740de
- Parent
- 8b20804e40ef
test/bundle_misc_c_37.rbaddedView file
# Bundled tests:# - kw_nil_default_string_call (show -> t_kw_show)# - optional_string_param_method (parse -> t_osp_parse)# - poly_box_int_array (kind_of -> t_pbia_kind_of)# - poly_or_returns_value (pick / pick_int -> t_porv_*)# - each_with_object_seed_shadow (f -> t_ewoss_f)# - fetch_nil_default_int_lv (f -> t_fndi_f)# - no_keywords_param (add -> t_nkp_add)# - sym_case (classify -> t_sc_classify)## Each inner top-level def is renamed with a per-test prefix to# avoid cross-test collisions when the bundle is compiled.# === kw_nil_default_string_call ===def t_kw_show(x: nil) puts xenddef t_kw_nil_default_string_call t_kw_show(x: "hi") t_kw_show(x: nil)endt_kw_nil_default_string_call# === optional_string_param_method ===def t_osp_parse(source, file_path = nil) if file_path puts file_path.length else puts source.length endenddef t_optional_string_param_method t_osp_parse("abc", "name.rb") t_osp_parse("abc") t_osp_parse("longer", "another_name.rb")endt_optional_string_param_method# === poly_box_int_array ===def t_pbia_kind_of(a) a.nil? ? "nil" : "something"enddef t_poly_box_int_array puts t_pbia_kind_of(Object.new) puts t_pbia_kind_of([1, 2, 3])endt_poly_box_int_array# === poly_or_returns_value ===def t_porv_pick(a, b) a || benddef t_porv_pick_int(a, b) a || benddef t_poly_or_returns_value puts t_porv_pick(nil, "fallback") puts t_porv_pick("actual", "fallback") puts t_porv_pick_int(0, 5) puts(nil || "direct")endt_poly_or_returns_value# === each_with_object_seed_shadow ===def t_ewoss_f obj = 42 out = [1, 2, 3].each_with_object([]) { |x, obj| obj.push(x * 2) } puts out[0] # 2 puts out[1] # 4 puts out[2] # 6 puts obj # 42endt_ewoss_f# === fetch_nil_default_int_lv ===def t_fndi_f(opts = {}) v = opts.fetch(:k, nil) v.nil? ? "missing" : "found"enddef t_fetch_nil_default_int_lv puts t_fndi_fendt_fetch_nil_default_int_lv# === no_keywords_param ===def t_nkp_add(a, b, **nil) a + benddef t_no_keywords_param puts t_nkp_add(1, 2) puts t_nkp_add(10, 20)endt_no_keywords_param# === sym_case ===def t_sc_classify(sym) case sym when :red then "warm" when :orange then "warm" when :blue then "cool" when :green then "cool" else "unknown" endenddef t_sym_case puts t_sc_classify(:red) puts t_sc_classify(:orange) puts t_sc_classify(:blue) puts t_sc_classify(:purple)endt_sym_casetest/bundle_misc_c_37.rb.expectedaddedView file
Loading diff…
test/each_with_object_seed_shadow.rbdeleted
Loading diff…
test/each_with_object_seed_shadow.rb.expecteddeleted
Loading diff…
test/fetch_nil_default_int_lv.rbdeleted
Loading diff…
test/fetch_nil_default_int_lv.rb.expecteddeleted
Loading diff…
test/kw_nil_default_string_call.rbdeleted
Loading diff…
test/kw_nil_default_string_call.rb.expecteddeleted
Loading diff…
test/no_keywords_param.rbdeleted
Loading diff…
test/no_keywords_param.rb.expecteddeleted
Loading diff…
test/optional_string_param_method.rbdeleted
Loading diff…
test/optional_string_param_method.rb.expecteddeleted
Loading diff…
test/poly_box_int_array.rbdeleted
Loading diff…
test/poly_box_int_array.rb.expecteddeleted
Loading diff…
test/poly_or_returns_value.rbdeleted
Loading diff…
test/poly_or_returns_value.rb.expecteddeleted
Loading diff…
test/sym_case.rbdeleted
Loading diff…
test/sym_case.rb.expecteddeleted
Loading diff…