diff --git a/src/autowiring/test/AutoConstructTest.cpp b/src/autowiring/test/AutoConstructTest.cpp index 6ac8e1e09..e476f6735 100644 --- a/src/autowiring/test/AutoConstructTest.cpp +++ b/src/autowiring/test/AutoConstructTest.cpp @@ -58,4 +58,28 @@ TEST_F(AutoConstructTest, CanConstructRvalueCtor) { TEST_F(AutoConstructTest, CanCopyAutoConstruct) { AutoConstruct v(100); -} \ No newline at end of file +} + +namespace { + class MyPrivateCtorClass { + MyPrivateCtorClass(void): + ival(-10) + {} + MyPrivateCtorClass(int ival) : + ival(ival) + {} + + public: + const int ival; + + static MyPrivateCtorClass* New(int ival) { + return new MyPrivateCtorClass{ ival }; + } + }; +} + +TEST_F(AutoConstructTest, FactoryNewPrivateCtor) { + AutoConstruct mpcc{ 1002 }; + ASSERT_NE(nullptr, mpcc.get()) << "Null not expected as a return type from a factory new construction"; + ASSERT_EQ(1002, mpcc->ival) << "Correct ctor was not invoked on a type with a private ctor"; +}