Applications with a terminal interface can be tested by setting TERM=xterm, giving them a virtual TTY by using pipetty (from colorized-logs), sending input to them using printf, piping the output through ansi2txt (from colorized-logs), converting output CR characters to LF characters and inspecting the files or other output for correct patterns. An example of this approach is in src:hexedit.