File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/jsTest/kotlin/it/krzeminski/githubactionstyping Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import io.kotest.matchers.should
1313import io.kotest.matchers.shouldNot
1414import io.kotest.mpp.env
1515import node.buffer.BufferEncoding.Companion.utf8
16+ import node.fs.Dir
1617import node.fs.exists
1718import node.fs.existsSync
1819import node.fs.opendir
@@ -38,7 +39,7 @@ class AjvSchemaValidationTest : FunSpec({
3839 withClue("catalogDir should be a non-empty directory") {
3940 exists(catalogDir).shouldBeTrue()
4041 stat(catalogDir).isDirectory().shouldBeTrue()
41- opendir(catalogDir).read().await().shouldNotBeNull()
42+ opendir(catalogDir).use { it. read().await().shouldNotBeNull() }
4243 }
4344
4445 validate = Ajv (AjvOptions (strict = true)).compile(
@@ -98,3 +99,7 @@ private suspend fun String.shouldNotBeValid(): String {
9899 readFile(path.join(badDir, this ), utf8) shouldNot beValid()
99100 return this
100101}
102+
103+ private inline fun <R > Dir.use (block : (Dir ) -> R ): R =
104+ AutoCloseable { closeSync() }
105+ .use { block(this ) }
You can’t perform that action at this time.
0 commit comments