Skip to content

Record

sh
ruby-anything record <repo> <unit-id>                         # generated edge cases
ruby-anything record <repo> <unit-id> --inputs real.jsonl     # {"fn": name, "args": [...]} per line
ruby-anything record <repo> <unit-id> --from-tests -- pytest  # or: npx jest, npx vitest run, node --test
ruby-anything record <repo> <unit-id> --pin-clock             # time and dates read 2026-01-01T00:00:00Z

record runs the original on generated and given inputs and saves what each call returns, raises and prints to rails/port/cases/*.jsonl. These cases are the spec the port must match.

Your tests become cases

--from-tests -- <test command> runs the original's own suite with the function instrumented (Python, TypeScript, JavaScript), and every distinct call it makes becomes a case next to the generated ones (--no-generate for only those). The source file is restored byte for byte afterwards, also after a crash.

The clock

When the function reads the clock (datetime.now, Date.now, time.time, date.today), record with --pin-clock. The original then sees 2026-01-01T00:00:00Z, and diff runs the port with Time.now, Date.today and DateTime.now frozen at the same instant.

Random numbers cannot match across languages: make the random value an argument (or inject a generator) instead.

Edit this page on GitHub →