1. 10
  1. 3

    Did something pretty similar during my interview process for the company I’m working in. The exercise was to make a chat-like TUI with some specific rules.

    Being chat-like it didn’t use any ncurses-like crazyness and was limited to writing chars and newlines to stdout and accepting commands, so it was really easy to test the behavior in a end-to-end fashion, because the test could run the final binary in a child process and pipe stdin/stdout. Built some test utilites to write to stdin and read from stdout splitting on newlines and called it a day.

    With a static-site generator of mine did some tests that compared the file hierarchy and contents of a “expected” folder with the actual generated folder, and now can confidently update any npm dependency without fear.

    Writing e2e tests for relatively simple tools like these is really easy and should be more common!