ffi 3.2 B: locked-in golden test for the Obj-C selector mangling table
`examples/ffi-objc-dsl-07-mangling-table.sx` exercises every common
mangling shape in one fixture and pins the resolved selectors via
both `.txt` and `.ir` snapshots:
| sx method | derived selector |
|-----------------------------------|----------------------------|
| `length` | `length` |
| `addObject(o)` | `addObject:` |
| `combine_and(a, b)` | `combine:and:` |
| `insert_after_index(a, b, c)` | `insert:after:index:` |
| `add_observer_for_event(a, b, c, d)` | `add:observer:for:event:` |
| `initWithFrame_options(f, o)` | `initWithFrame:options:` |
| `custom_name #selector("actualSelectorName")` | `actualSelectorName` |
The class is synthesized at runtime via `objc_allocateClassPair` +
`class_addMethod` per selector (mirrors the pattern in
`ffi-objc-dsl-{01..05}.sx`), so the test actually dispatches through
the real Obj-C runtime on macOS.
Single commit because the implementation already shipped in 3.0/3.2;
this is a new regression that locks in current behavior, not a
test-then-make-green pair.
The `.ir` snapshot opts in via the existing run_examples.sh mechanism
(presence of a `.ir` file for the same name triggers capture). The
captured `OBJC_METH_VAR_NAME_*` constants surface every selector
string change at a glance.
166/166 tests.
This commit is contained in:
@@ -536,9 +536,14 @@ arity-mismatch under the override path downgrades from `.err` to
|
||||
`GetMethodID` validates descriptors). Snapshot for
|
||||
`ffi-objc-dsl-06-selector-override.sx` flipped to working output.
|
||||
|
||||
Phase 3.2 B landed:
|
||||
`examples/ffi-objc-dsl-07-mangling-table.sx` exercises 7 mangling
|
||||
shapes (niladic, arity 1-4, camelCase across pieces, override) in
|
||||
one fixture. Both `.txt` and `.ir` snapshots locked — a change to
|
||||
`deriveObjcSelector` produces one diff that surfaces every affected
|
||||
case at once via the `OBJC_METH_VAR_NAME_*` constants in the IR.
|
||||
|
||||
Open work, in roughly the order they make sense:
|
||||
- **Phase 3 step 3.2 — B (golden mangling table)** — locked-in IR
|
||||
fixture for the default mangling rule.
|
||||
- **Phase 3 step 3.2 — C1..C5** — uikit.sx migration, one cluster
|
||||
per commit, chess regression after each.
|
||||
test for the default-mangling table. Escape hatch for selectors
|
||||
|
||||
Reference in New Issue
Block a user