From e3f484e78fef3cb8bda7b5cdcd789ce047d703b3 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 4 Mar 2012 05:24:42 +0000 Subject: [PATCH] added unit test for unc paths on windows --- test/test_primitives.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test_primitives.cpp b/test/test_primitives.cpp index e045f97b7..9b6f2b012 100644 --- a/test/test_primitives.cpp +++ b/test/test_primitives.cpp @@ -1124,6 +1124,25 @@ int test_main() TEST_CHECK(verify_encoding(test)); TEST_CHECK(test == "filename=4"); + // file class + file f; +#if TORRENT_USE_UNC_PATHS || !defined WIN32 + TEST_CHECK(f.open("con", file::read_write, ec)); +#else + TEST_CHECK(f.open("test_file", file::read_write, ec)); +#endif + TEST_CHECK(!ec); + file::iovec_t b = {"test", 4}; + TEST_CHECK(f.writev(0, &b, 1, ec) == 4); + TEST_CHECK(!ec); + char test_buf[5] = {0}; + b.iov_base = test_buf; + b.iov_len = 4; + TEST_CHECK(f.readv(0, &b, 1, ec) == 4); + TEST_CHECK(!ec); + TEST_CHECK(strcmp(test_buf, "test") == 0); + f.close(); + // HTTP request parser http_parser parser; boost::tuple received;