Explorar el Código

Test for #7544 (#8679)

* Add test for #7544

* move to sys tests

* remove from unit tests

* don't forget to close

* fix
Aleksandr Kuzmenko hace 6 años
padre
commit
6ccdd40366
Se han modificado 1 ficheros con 21 adiciones y 0 borrados
  1. 21 0
      tests/sys/src/io/TestFileInput.hx

+ 21 - 0
tests/sys/src/io/TestFileInput.hx

@@ -213,5 +213,26 @@ class TestFileInput extends utest.Test {
 		}
 		file.close();
 	}
+
+	function testIssue7544() {
+		var file = sys.io.File.read(path, true);
+		var buf = haxe.io.Bytes.alloc(contentBytes.length);
+
+		function next() {
+			try {
+				var read = file.readBytes(buf, 0, contentBytes.length);
+				return Std.string(read);
+			} catch(e:haxe.io.Eof) {
+				return Std.string('eof');
+			} catch(e:Dynamic) {
+				return Std.string(e);
+			}
+		}
+
+		Assert.equals('24', next());
+		next(); // TODO: at this line, some target produce '0', some produce 'eof', do we need to unify?
+		Assert.equals('eof', next());
+		file.close();
+	}
 }