Add a test for svn_stream__install_stream_get_info().
* subversion/tests/libsvn_subr/io-test.c
(test_install_stream_get_info): New test.
(test_funcs): Run the new test.
@@ -1118,6 +1118,47 @@ test_install_stream_set_affected_time(apr_pool_t *pool)
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_install_stream_get_info(apr_pool_t *pool)
+{
+ const char *tmp_dir;
+ const char *final_abspath;
+ svn_stream_t *stream;
+ apr_time_t mtime;
+ apr_off_t size;
+ svn_stringbuf_t *actual_content;
+ apr_finfo_t finfo;
+
+ /* Create an empty directory. */
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir,
+ "test_install_stream_get_info",
+ pool));
+
+ final_abspath = svn_dirent_join(tmp_dir, "stream1", pool);
+
+ SVN_ERR(svn_stream__create_for_install(&stream, tmp_dir, pool, pool));
+ SVN_ERR(svn_stream_puts(stream, "stream1 content"));
+ SVN_ERR(svn_stream_close(stream));
+ SVN_ERR(svn_stream__install_get_info(&mtime, &size, stream, pool));
+ SVN_ERR(svn_stream__install_stream(stream,
+ final_abspath,
+ TRUE,
+ pool));
+ /* Should see the same values as before the install. */
+ SVN_ERR(svn_io_stat(&finfo, final_abspath,
+ APR_FINFO_MTIME | APR_FINFO_SIZE,
+ pool));
+ SVN_TEST_INT_ASSERT(mtime, finfo.mtime);
+ SVN_TEST_INT_ASSERT(size, finfo.size);
+
+ SVN_ERR(svn_stringbuf_from_file2(&actual_content,
+ final_abspath,
+ pool));
+ SVN_TEST_STRING_ASSERT(actual_content->data, "stream1 content");
+
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
test_file_size_get(apr_pool_t *pool)
{
@@ -1334,6 +1375,8 @@ static struct svn_test_descriptor_t test_funcs[] =
"test svn_stream__install_stream_set_read_only"),
SVN_TEST_PASS2(test_install_stream_set_affected_time,
"test svn_stream__install_stream_set_affected_time"),
+ SVN_TEST_PASS2(test_install_stream_get_info,
+ "test svn_stream__install_stream_get_info"),
SVN_TEST_PASS2(test_file_size_get,
"test svn_io_file_size_get"),
SVN_TEST_PASS2(test_file_rename2,
