From 901761af0377835685c98a752443dfd6497e254a Mon Sep 17 00:00:00 2001 From: tobil4sk Date: Thu, 7 Mar 2024 17:59:11 +0000 Subject: [PATCH] Add test for FileSystem.readDirectory error If the directory doesn't exist, the function is expected to throw. --- tests/sys/src/TestFileSystem.hx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/sys/src/TestFileSystem.hx b/tests/sys/src/TestFileSystem.hx index 385086b992c..757831bf0b2 100644 --- a/tests/sys/src/TestFileSystem.hx +++ b/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 {