Added a test that demonstrates bad behaviour with no new line at the end
Fixed problem with no-newline-at-end, but caller needs to flush()