aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/error.cpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-10-14 03:10:23 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-10-14 03:10:23 +0300
commit8fe642b86c85ec45f27424108d7a5d6fae25fe25 (patch)
treed6ee95e995a2b8e4cd753f72056aa30d3cc73c8e /test/error.cpp
parentAppVeyor: reorder images, 2013 second (diff)
downloadwinapi-common-8fe642b86c85ec45f27424108d7a5d6fae25fe25.tar.gz
winapi-common-8fe642b86c85ec45f27424108d7a5d6fae25fe25.zip
add error-handling functions
They are almost exact copies from my pdb-repo project at https://github.com/egor-tensin/pdb-repo/tree/fa2afec5e7af45e7f1440b2d32c2a4e63dad6a62 I'm currently thinking about renaming it to winapi-debug BTW.
Diffstat (limited to 'test/error.cpp')
-rw-r--r--test/error.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/error.cpp b/test/error.cpp
new file mode 100644
index 0000000..f70d95d
--- /dev/null
+++ b/test/error.cpp
@@ -0,0 +1,23 @@
+// Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "winapi-common" project.
+// For details, see https://github.com/egor-tensin/winapi-common.
+// Distributed under the MIT License.
+
+#include <winapi/error.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+#include <windows.h>
+
+#include <string>
+
+BOOST_AUTO_TEST_SUITE(error_tests)
+
+BOOST_AUTO_TEST_CASE(file_not_found) {
+ const std::string actual{winapi::error::windows(ERROR_FILE_NOT_FOUND, "CreateFileW").what()};
+ BOOST_TEST(actual ==
+ "Function CreateFileW failed with error code 2: The system cannot find the file "
+ "specified.");
+}
+
+BOOST_AUTO_TEST_SUITE_END()