Documentation
¶
Overview ¶
Package assert provides assertion helpers for comparing SVG outputs against SVGO test fixture expectations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeCanonical ¶
NormalizeCanonical applies the full L2 normalization pipeline:
- Unify line endings (LF)
- Remove trailing whitespace per line
- Remove excess blank lines (max 1 consecutive blank line)
- Trim leading/trailing whitespace
Note: Attribute sorting and numeric normalization are deferred to when we have the XAST parser available (Phase 2+). For now, L2 provides text-level normalization only.
func NormalizeLF ¶
NormalizeLF converts all line endings to LF and trims the string. This matches SVGO's normalize: file.trim().replaceAll(EOL, '\n')
Types ¶
type L1Result ¶
L1Result holds the result of an L1 strict comparison.
func L1StrictEqual ¶
L1StrictEqual performs L1 (strict snapshot) comparison.
It normalizes both strings (trim + LF) and then compares them byte-for-byte. This matches SVGO's test assertion: expect(normalize(result.data)).toStrictEqual(should)
type L2Result ¶
L2Result holds the result of an L2 canonical comparison.
func L2CanonicalEqual ¶
L2CanonicalEqual performs L2 (canonical equivalence) comparison.
It applies the full normalization pipeline to both strings and compares. This is more lenient than L1: it tolerates trailing whitespace differences, extra blank lines, etc.
Note: Full L2 normalization (attribute sorting, numeric normalization) will be enhanced once the XAST parser is available. Currently provides text-level normalization.