Tinyeval (tinyeval v0.11.0)

Copy Markdown View Source

A worker for tinyeval: your app starts once and answers every test case.

# evals/worker.exs, started by `worker mix run --no-start evals/worker.exs`
Tinyeval.worker(fn input -> MyApp.Support.answer(input) end)

See the README for the rest.

Summary

Functions

Answers each input tinyeval sends with answer.(input), until tinyeval is done.

Functions

worker(answer)

@spec worker((String.t() -> String.t())) :: :ok

Answers each input tinyeval sends with answer.(input), until tinyeval is done.

It first points stdout at stderr, so output from your app can't mix with the replies, then starts your app when Mix is running. Start the worker with mix run --no-start, so your app starts after that. Tinyeval.CouldntRun marks the run as couldn't run, and any other error becomes the reply, so the eval fails.