ez8-co / emock

🐞 下一代C/C++跨平台mock库 (Next generation cross-platform mock library for C/C++)
Apache License 2.0
118 stars 35 forks source link

Windows 上mock global function, 报异常 #44

Open lxr5109 opened 2 days ago

lxr5109 commented 2 days ago

直接用的README里的示例: ` // 待测函数 int foobar(int x) { return x; }

TEST_F(FooTest, foobar_test) {

// 测试时,像下面这样就可以mock
EMOCK(foobar)
    .stubs()
    .with(any()) // 约束匹配任意输入
    .will(returnValue(1)); // 调用时返回1

// 调用会返回1
EXPECT_EQ(foobar(0), 1);

} ` 然后报了异常: image