Module: Oselvar::Var::Core::FailureAnchor
- Defined in:
- lib/oselvar/var/core/failure_anchor.rb
Overview
Where a failure points in the .md source: a mismatch anchors at its first failing span (cell / doc-string body), anything else at the fallback (the step's match span). The single source of truth for failure locations, pinned as failure.anchor in the conformance trace. Port of failure-anchor.ts.
Class Method Summary collapse
Class Method Details
.failure_anchor(error, fallback) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/oselvar/var/core/failure_anchor.rb', line 16 def failure_anchor(error, fallback) case error when CellMismatchError failing = error.cells.find { |c| !c.ok } failing ? failing.span : fallback when DocStringMismatchError error.diff.span else fallback end end |