Quellcode durchsuchen

Add test for FileSystem.readDirectory error (#11601)

If the directory doesn't exist, the function is expected to throw.
tobil4sk vor 1 Jahr
Ursprung
Commit
795768d6b7
1 geänderte Dateien mit 7 neuen und 0 gelöschten Zeilen
  1. 7 0
      tests/sys/src/TestFileSystem.hx

+ 7 - 0
tests/sys/src/TestFileSystem.hx

@@ -60,6 +60,13 @@ class TestFileSystem extends utest.Test {
 			//read directory with complex path
 			Assert.isTrue(FileSystem.readDirectory("../sys/./.." + tailingSlash).indexOf("sys") > -1);
 		}
+		// should throw if directory doesn't exist
+		try {
+			FileSystem.readDirectory("non-existant");
+			Assert.isFalse(true);
+		} catch (_) {
+			Assert.isTrue(true);
+		}
 	}
 
 	function testCreateDirectory():Void {