Index: code/branches/cpp11_v2/test/core/command/FunctorTest.cc
===================================================================
--- code/branches/cpp11_v2/test/core/command/FunctorTest.cc	(revision 10984)
+++ code/branches/cpp11_v2/test/core/command/FunctorTest.cc	(revision 10986)
@@ -71,4 +71,5 @@
         int f4a(int arg) { return arg*2; }
         int f4b(int arg) { return arg*3; }
+        int multiply(int a, int b) { return a*b; }
 
         struct CallableStruct
@@ -634,4 +635,104 @@
     ////////////////////////////// Various tests //////////////////////////////
 
+    TEST_F(FunctorTest, CreateFunctorWithVariousFunctionTypes)
+    {
+        FunctorPtr c1 = createFunctor(&f4a);
+        FunctorPtr c2 = createFunctor(&f4b);
+        FunctorPtr c3 = createFunctor([] (int arg) { return arg*4; });
+        auto lambda = [] (int arg1, int arg2) { return arg1*arg2; };
+        FunctorPtr c4 = createFunctor(lambda);
+
+        std::function<int()> bind0 = std::bind(multiply, 4, 6);
+        std::function<int(int)> bind1 = std::bind(multiply, std::placeholders::_1, 7);
+        std::function<int(int, int)> bind2 = std::bind(multiply, std::placeholders::_1, std::placeholders::_2);
+        std::function<int(int)> function = f4a;
+
+        FunctorPtr c5 = createFunctor(bind0);
+        FunctorPtr c6 = createFunctor(bind1);
+        FunctorPtr c7 = createFunctor(bind2);
+        FunctorPtr c8 = createFunctor(function);
+
+
+        EXPECT_EQ(8,  (*c1)(4).get<int>());
+        EXPECT_EQ(12, (*c2)(4).get<int>());
+        EXPECT_EQ(16, (*c3)(4).get<int>());
+        EXPECT_EQ(20, (*c4)(4, 5).get<int>());
+        EXPECT_EQ(24, (*c5)(4).get<int>());
+        EXPECT_EQ(28, (*c6)(4).get<int>());
+        EXPECT_EQ(32, (*c7)(4, 8).get<int>());
+        EXPECT_EQ(8,  (*c8)(4).get<int>());
+
+        EXPECT_EQ(1, c1->getParamCount());
+        EXPECT_EQ(1, c2->getParamCount());
+        EXPECT_EQ(1, c3->getParamCount());
+        EXPECT_EQ(2, c4->getParamCount());
+        EXPECT_EQ(0, c5->getParamCount());
+        EXPECT_EQ(1, c6->getParamCount());
+        EXPECT_EQ(2, c7->getParamCount());
+        EXPECT_EQ(1, c8->getParamCount());
+
+        EXPECT_EQ(typeid(int(*)(int)), c1->getFullIdentifier());
+        EXPECT_EQ(typeid(int(*)(int)), c2->getFullIdentifier());
+        EXPECT_EQ(typeid(int(*)(int)), c3->getFullIdentifier());
+        EXPECT_EQ(typeid(int(*)(int, int)), c4->getFullIdentifier());
+        EXPECT_EQ(typeid(int(*)()), c5->getFullIdentifier());
+        EXPECT_EQ(typeid(int(*)(int)), c6->getFullIdentifier());
+        EXPECT_EQ(typeid(int(*)(int, int)), c7->getFullIdentifier());
+        EXPECT_EQ(typeid(int(*)(int)), c8->getFullIdentifier());
+
+        EXPECT_EQ(typeid(int(*)(int)), c1->getHeaderIdentifier());
+        EXPECT_EQ(typeid(int(*)(int)), c2->getHeaderIdentifier());
+        EXPECT_EQ(typeid(int(*)(int)), c3->getHeaderIdentifier());
+        EXPECT_EQ(typeid(int(*)(int, int)), c4->getHeaderIdentifier());
+        EXPECT_EQ(typeid(int(*)()), c5->getHeaderIdentifier());
+        EXPECT_EQ(typeid(int(*)(int)), c6->getHeaderIdentifier());
+        EXPECT_EQ(typeid(int(*)(int, int)), c7->getHeaderIdentifier());
+        EXPECT_EQ(typeid(int(*)(int)), c8->getHeaderIdentifier());
+
+        EXPECT_EQ(typeid(int(*)(int)), c1->getHeaderIdentifier(1));
+        EXPECT_EQ(typeid(int(*)(int)), c2->getHeaderIdentifier(1));
+        EXPECT_EQ(typeid(int(*)(int)), c3->getHeaderIdentifier(1));
+        EXPECT_EQ(typeid(int(*)(int)), c4->getHeaderIdentifier(1));
+        EXPECT_EQ(typeid(int(*)()), c5->getHeaderIdentifier(1));
+        EXPECT_EQ(typeid(int(*)(int)), c6->getHeaderIdentifier(1));
+        EXPECT_EQ(typeid(int(*)(int)), c7->getHeaderIdentifier(1));
+        EXPECT_EQ(typeid(int(*)(int)), c8->getHeaderIdentifier(1));
+
+        EXPECT_EQ(typeid(int(*)()), c1->getHeaderIdentifier(0));
+        EXPECT_EQ(typeid(int(*)()), c2->getHeaderIdentifier(0));
+        EXPECT_EQ(typeid(int(*)()), c3->getHeaderIdentifier(0));
+        EXPECT_EQ(typeid(int(*)()), c4->getHeaderIdentifier(0));
+        EXPECT_EQ(typeid(int(*)()), c5->getHeaderIdentifier(0));
+        EXPECT_EQ(typeid(int(*)()), c6->getHeaderIdentifier(0));
+        EXPECT_EQ(typeid(int(*)()), c7->getHeaderIdentifier(0));
+        EXPECT_EQ(typeid(int(*)()), c8->getHeaderIdentifier(0));
+    }
+
+    TEST_F(FunctorTest, CanCallFunctorWithLambdaWichIsAlreadyOutOfScope)
+    {
+        int var1 = 1;
+        FunctorPtr fp1a = createFunctor([&var1] () { return var1++; });
+        FunctorPtr fp1b = createFunctor([&var1] () { return var1; });
+        FunctorPtr fp2;
+        FunctorPtr fp3;
+
+        {
+            int var2 = 2;
+            fp2 = createFunctor([var2] () { return var2; });
+        }
+        {
+            int var3 = 3;
+            fp3 = createFunctor([var3] () { return var3; });
+        }
+
+        EXPECT_EQ(1, var1);
+        EXPECT_EQ(1, (*fp1a)().get<int>());
+        EXPECT_EQ(2, var1);
+        EXPECT_EQ(2, (*fp1b)().get<int>());
+
+        EXPECT_EQ(2, (*fp2)().get<int>());
+        EXPECT_EQ(3, (*fp3)().get<int>());
+    }
+
     TEST_F(FunctorTest, canCompareHeaderIdentifiers)
     {
