Improve IO.ANSI test case so it can be run on non-terminals correctly