سؤال

أتلقى خطأ في الترجمة أثناء استخدام Google Mock إعلان: giveacodicetagpre.

الخطأ هو: giveacodicetagpre.

ماذا أفعل الخطأ؟


التحديثات:

أنا أستخدم vs2010.

إعلان وظيفي هو: giveacodicetagpre.

an () هو google mock millcard matcher مع ما يليالتعريف: giveacodicetagpre.

نسخة تمثيلية مبسطة من الهيكل هي: giveacodicetagpre.

هل كانت مفيدة؟

المحلول

The solution was to change the declaration from:

EXPECT_CALL(some_object, someFunction(1,An<AStructIDefined>()))
    .Times(2);

to

EXPECT_CALL(some_object, someFunction(1,An<const AStructIDefined &>()))
    .Times(2);

C++ implicitly casts const and reference & on function parameters, but google mock's declaration seems to require the type appearing in the function's signature and not the type submitted as a parameter to the function.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top