bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2016-2018 Dovecot authors, see the included COPYING file */
b2ff0468c298dd2f525fff5977f1f24fba3a9f3bTimo Sirainen unsigned int i;
b2ff0468c298dd2f525fff5977f1f24fba3a9f3bTimo Sirainen if (fs_init("metawrap", "test", &fs_set, &fs, &error) < 0)
b2ff0468c298dd2f525fff5977f1f24fba3a9f3bTimo Sirainen for (i = 0; i < 2; i++) {
b2ff0468c298dd2f525fff5977f1f24fba3a9f3bTimo Sirainen file = fs_file_init(fs, "foo", FS_OPEN_MODE_READONLY);
b2ff0468c298dd2f525fff5977f1f24fba3a9f3bTimo Sirainen str_append(test_file->contents, "key:value\n\n12345678901234567890");
b2ff0468c298dd2f525fff5977f1f24fba3a9f3bTimo Sirainen if (i == 0) {
b2ff0468c298dd2f525fff5977f1f24fba3a9f3bTimo Sirainen test_istream_set_max_buffer_size(test_file->input, 2);
b2ff0468c298dd2f525fff5977f1f24fba3a9f3bTimo Sirainen test_assert_idx(fs_stat(file, &st) == 0 && st.st_size == 20, i);
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainen test_fs_async("metawrap", FS_PROPERTY_METADATA, "metawrap", "test");
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainen test_fs_async("metawrap passthrough", 0, "metawrap", "test");
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainen test_fs_async("double-metawrap", FS_PROPERTY_METADATA, "metawrap", "metawrap:test");
96e1ed172ae59cae6bc6e6ddd24d22a158e23dfeTimo Sirainen if (fs_init("metawrap", "test", &fs_set, &fs, &error) < 0)
96e1ed172ae59cae6bc6e6ddd24d22a158e23dfeTimo Sirainen struct fs_file *file = fs_file_init(fs, "foo", FS_OPEN_MODE_REPLACE);
96e1ed172ae59cae6bc6e6ddd24d22a158e23dfeTimo Sirainen struct ostream *output = fs_write_stream(file);
96e1ed172ae59cae6bc6e6ddd24d22a158e23dfeTimo Sirainen test_assert(fs_write_stream_finish(file, &output) > 0);
baf3e87e186453fda13bd21f7cbcb2efc8492e8bTimo Sirainen static void (*const test_functions[])(void) = {