Developer Ports Python Library to Rust: 1,059 Tests Pass but Unicode Bug Lurks
A developer participating in a hackathon ported Scrapinghub's price-parser Python library to Rust, successfully passing all 1,059 unmodified tests from the original test suite. Despite the clean test results, the port contained a subtle bug: Python's Decimal type accepts any Unicode decimal digit, while Rust's equivalent only handles ASCII, causing prices written in Arabic-Indic, Devanagari, or Bengali numerals to silently return no value. The flaw was not caught by the existing test suite because the upstream corpus was drawn entirely from Western storefronts, meaning non-ASCII digit inputs were never tested. The bug was ultimately discovered by running 500,000 randomly generated price strings through both implementations simultaneously and comparing outputs. The case highlights a fundamental limitation of test suites: they can only cover inputs that someone has already thought to include.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in