Principle:20000419 Fauxnix Identity Comparison
| Knowledge Sources | |
|---|---|
| Domains | Testing, Comparison |
| Last Updated | 2026-10-26 00:00 GMT |
Overview
A comparison technique that determines whether two command executions (system under test vs oracle) produced identical observable behavior by normalizing CRLF in stdout/stderr and requiring exact exit-code equality.
Description
Identity Comparison is the equality predicate behind the differential gate. Two Streams (stdout, stderr, exitCode) are identical when the CRLF-normalized stdout strings match, the CRLF-normalized stderr strings match, and the exit codes are exactly equal. CRLF normalization (normalizeNewlines) converts \r\n and lone \r to \n before comparison, because the Windows PowerShell host and Git Bash terminate lines differently while the observable content is the same. This normalization is deliberate: it avoids false mismatches on line-ending differences that a user would never notice, while still catching real content and exit-code differences.
Usage
Use this principle when comparing command output across shells that may differ only in line-ending conventions. The CRLF-normalize-then-exact-compare approach is the right choice when the shells run on the same OS but use different console line-ending defaults.
Theoretical Basis
sameIdentity(a, b):
normalizeNewlines(a.stdout) === normalizeNewlines(b.stdout)
and normalizeNewlines(a.stderr) === normalizeNewlines(b.stderr)
and a.exitCode === b.exitCode
normalizeNewlines(s):
s.replace('\r\n', '\n').replace('\r', '\n')