summaryrefslogtreecommitdiffstats
path: root/fluent-bit/tests/internal/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/tests/internal/file.c')
-rw-r--r--fluent-bit/tests/internal/file.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/fluent-bit/tests/internal/file.c b/fluent-bit/tests/internal/file.c
deleted file mode 100644
index 974c2668..00000000
--- a/fluent-bit/tests/internal/file.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <fluent-bit/flb_file.h>
-#include <fluent-bit/flb_sds.h>
-#include <string.h>
-
-#include "flb_tests_internal.h"
-#include "fluent-bit/stream_processor/flb_sp.h"
-
-#define TEXT_FILE FLB_TESTS_DATA_PATH "/data/file/text_file.txt"
-#define EMPTY_FILE FLB_TESTS_DATA_PATH "/data/file/empty_file.txt"
-
-static void check_equals(flb_sds_t result, const char *expected)
-{
- size_t expected_len = strlen(expected);
- size_t result_len = flb_sds_len(result);
- TEST_CHECK(expected_len == result_len);
- TEST_MSG("Expected length: %zu", expected_len);
- TEST_MSG("Actual length: %zu", result_len);
- TEST_CHECK(memcmp(result, expected, expected_len) == 0);
- TEST_MSG("Expected: %s", expected);
- TEST_MSG("Actual: %s", result);
-}
-
-static void test_file_read_text_file()
-{
- flb_sds_t result = flb_file_read(TEXT_FILE);
- check_equals(result, "Some text file\n\nline 3\n\nline 5\n");
- flb_sds_destroy(result);
-}
-
-static void test_file_read_empty_file()
-{
- flb_sds_t result = flb_file_read(EMPTY_FILE);
- check_equals(result, "");
- flb_sds_destroy(result);
-}
-
-static void test_file_read_missing()
-{
- flb_sds_t result = flb_file_read(TEXT_FILE ".missing");
- TEST_CHECK(result == NULL);
-}
-
-TEST_LIST = {
- { "file_read_text_file" , test_file_read_text_file},
- { "file_read_empty_file" , test_file_read_empty_file},
- { "file_read_missing" , test_file_read_missing},
- { 0 }
-};