Raxol.StableInspect (Raxol v2.6.1)

View Source

Version-stable string quoting for golden artifacts.

inspect/1's string escaping tracks the host Elixir release (1.18 started printing zero-width and special-whitespace codepoints as \uXXXX), so a golden serialized with it drifts across CI's Elixir matrix even though the render is identical. Raxol.RATE and Raxol.Harness.Surface.Parity both pin cross-version artifacts, so their serializers use this frozen escape table instead: byte-for-byte the 1.18+ inspect/1 output for printable strings (the encoding the committed artifacts already contain), emitted identically on every supported release.

The table mirrors Code.Identifier.escape_char/2 as of Elixir 1.18: printable codepoints stay literal, the "confusing invisibles" become \uXXXX, control characters use their short escapes, and anything else falls back to \xNN. Unlike inspect/1, a non-printable string is still quoted (escaped byte by byte) rather than shown as <<...>> -- a stricter rule, and one that cannot vary by release.

Summary

Functions

Quote and escape text identically on every supported Elixir.

Functions

quoted(text)

@spec quoted(String.t()) :: String.t()

Quote and escape text identically on every supported Elixir.