]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/thread/test/sync/futures/promise/set_exception_pass.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / thread / test / sync / futures / promise / set_exception_pass.cpp
index 30b5a5a958dc3efcb8d8e5eeff19cf72114a4fd9..c27aec293836405b47627a457a5637d07f992ff0 100644 (file)
@@ -75,7 +75,36 @@ int main()
       BOOST_TEST(false);
     }
   }
-
+  {
+    typedef int T;
+    boost::promise<T> p;
+    boost::future<T> f = p.get_future();
+    p.set_exception_deferred(boost::make_exception_ptr(3));
+    BOOST_TEST(!f.is_ready());
+    p.notify_deferred();
+    try
+    {
+      f.get();
+      BOOST_TEST(false);
+    }
+    catch (boost::wrap<int> i)
+    {
+      BOOST_TEST(i.value == 3);
+    }
+    try
+    {
+      p.set_exception(boost::make_exception_ptr(3));
+      BOOST_TEST(false);
+    }
+    catch (const boost::future_error& e)
+    {
+      BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::promise_already_satisfied));
+    }
+    catch (...)
+    {
+      BOOST_TEST(false);
+    }
+  }
   return boost::report_errors();
 }