From f2f79644f7d905a0a02a10e59643fccc260a7963 Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Mon, 4 Mar 2024 03:27:41 -0500 Subject: [PATCH] Remove unit test (would throw exception if invalid flags) --- .../matthewnelson/kmp/file/FOpenUnitTest.kt | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 library/file/src/unixTest/kotlin/io/matthewnelson/kmp/file/FOpenUnitTest.kt diff --git a/library/file/src/unixTest/kotlin/io/matthewnelson/kmp/file/FOpenUnitTest.kt b/library/file/src/unixTest/kotlin/io/matthewnelson/kmp/file/FOpenUnitTest.kt deleted file mode 100644 index d7841c0..0000000 --- a/library/file/src/unixTest/kotlin/io/matthewnelson/kmp/file/FOpenUnitTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2024 Matthew Nelson - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ -package io.matthewnelson.kmp.file - -import kotlinx.cinterop.ExperimentalForeignApi -import platform.posix.* -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -@OptIn(DelicateFileApi::class, ExperimentalForeignApi::class) -class FOpenUnitTest { - - @Test - fun givenUnix_whenFileOpened_thenCLOEXEC() { - // 'e' automatically added when not present - val stat = FILE_LOREM_IPSUM.fOpen("rb") { file -> - val fd = fileno(file) - if (fd == -1) { - throw errnoToIOException(errno) - } - - fcntl(fd, F_GETFD) - } - - if (stat == -1) { - throw errnoToIOException(errno) - } - - val hasCloExec = (stat or FD_CLOEXEC) == stat - assertTrue(hasCloExec) - } -}