From 42cc01d79f624d1e93def0817446d1d2379b3f7d Mon Sep 17 00:00:00 2001 From: Mineplay5780 Date: Wed, 17 Dec 2025 23:00:42 +0100 Subject: [PATCH] fix(tests): added missing test for opening file --- tests/unit/file.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/unit/file.c b/tests/unit/file.c index 1aec04f..fc13064 100644 --- a/tests/unit/file.c +++ b/tests/unit/file.c @@ -109,6 +109,20 @@ COSMS_CORE_TEST_TEST(file_open, } } ) + + COSMS_CORE_TEST_SUB_TEST(opening non-existing file for reading, + struct cosms_core_file file; + CosmsCoreFileError error = cosms_core_file_open(&file, "non-existing-file.cosms", COSMS_CORE_FILE_MODE_READ); + if (error != COSMS_CORE_FILE_NOT_FOUND) { + cosms_core_test_sub_test_error = cosms_core_file_error_string(error); + if (error == COSMS_CORE_FILE_OK) { + error = cosms_core_file_close(&file); + if (error != COSMS_CORE_FILE_OK) { + cosms_core_test_sub_test_error = cosms_core_file_error_string(error); + } + } + } + ) ) COSMS_CORE_TEST_TEST(file_close,