Another reason it's important to write tests: locale


Another reason it's important to write tests: locale.

A dev in another country just submitted a PR that sorts numbers. The sort works for him, but fails for me.

Here's why:

His code assumes the numbers use a period as a separator: 1.234.

This fails in the US, because our locale uses a comma: 1,234.

If he had written a test, it would have caught the mistake on CI. Why? Because the CI server has a locale in the US. (the app is for a US audience)

View original on X