fix: return null from IO.read on EOF instead of empty string

Previously, IO.read would return an empty string when stdin reached EOF because it always called wrenReturnString with the buffer, even when fgets returned NULL. Now it returns null by only calling wrenReturnString when fgets succeeds, and adds a test case verifying that IO.read returns null on EOF.
This commit is contained in:
Bob Nystrom
2015-03-07 21:47:07 +00:00
2 changed files with 3 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
IO.write(IO.read) // expect: null