ExUnit CaptureIO and c.flush

Probably not, look at this remark from the modules documentation:

These functions are intended for interactive use in the Erlang shell only. The module prefix can be omitted.

Also :c.flush/0 shouldn’t return a tuple or a list (I assume thats what you are talking about when saying “array”), it should just return the atom :ok.

If you really want to flush the mailbox, you can implement this really easily:

def flush() do
  receive do
    _ -> flush()
  after
    0 -> :ok
  end
end

You can easily extend it to actually print or return the “flushed” messages if you need to.