added a check to add a newline to any lines that don't end in a newline....

... Without this, output from a script will be truncated to nothing. Also added a test for this condition to the test framework.