diff --git a/src/autowiring/test/AutoConstructTest.cpp b/src/autowiring/test/AutoConstructTest.cpp index 4c9018274..f25edc23d 100644 --- a/src/autowiring/test/AutoConstructTest.cpp +++ b/src/autowiring/test/AutoConstructTest.cpp @@ -80,4 +80,18 @@ TEST_F(AutoConstructTest, PostConstructGetsCalled) { AutoRequired cwai; ASSERT_TRUE(cwai->m_constructed) << "Trivial constructor call was not made as expected"; ASSERT_TRUE(cwai->m_postConstructed) << "Auto-initialization routine was not called on an initializable type"; +} + +class PostConstructThrowsException { +public: + void AutoInit(void) const { + throw std::runtime_error("Autoinit crashing for no reason"); + } +}; + +TEST_F(AutoConstructTest, PostConstructCanSafelyThrow) { + ASSERT_ANY_THROW(AutoRequired()) << "AutoInit call threw an exception, but it was incorrectly eaten by Autowiring"; + + Autowired pcte; + ASSERT_FALSE(pcte.IsAutowired()) << "A context member which threw an exception post-construction was incorrectly introduced into a context"; } \ No newline at end of file