Hacker News new | ask | show | jobs
by hyperhello 45 days ago
Strictly speaking that wouldn’t work, since a1 is different from a 1, for example.
1 comments

I don't think they're trying to say that this is a sufficient test for correctness but a necessary one.
Correct. It won't catch 100% of possible bugs, but it will catch most.

The kind of bugs that are easiest to write in a formatter is dropping a bit of syntax on the floor and forgetting to include it in the output, and the sanity check will catch those.

It's also definitely possible to miss some whitespace that's necessary for things like identifier separation, but... <shrug> it's a sanity check, not a proof of correctness.

In practice, that's how most software testing works anyhow!