cxxTestgen.py抛出语法错误
我按照cxxtest与Visual Studio集成的教程进行了操作,也在谷歌上查找过,但没有找到任何解决办法。
当我尝试在Visual Studio中运行一个基本的cxxtest测试时,出现了这个错误:
1>Generating main code for test suite
1> File "C:/cxxtest/cxxtestgen.py", line 60
1> print usageString()
1> ^
1>SyntaxError: invalid syntax
我现在在教程的第7步,所有设置都和教程里的一模一样。
这是基本的测试脚本:
#include <cxxtest/TestSuite.h>
class MyTestSuite : public CxxTest::TestSuite
{
public:
void testAddition( void )
{
TS_ASSERT( 1 + 1 > 1 );
TS_ASSERT_EQUALS( 1 + 1, 2 );
}
};
补充一下:我使用的是Python 3.0,这可能是问题所在吗?
3 个回答
0
试着在命令行中运行 cxxtestgen.py
。它会显示使用说明吗?
2
之前的评论说得对,CxxTest 3.x 版本不支持 Python 3.x。不过,最近发布了 CxxTest 4.0 版本,它支持 Python 3.1 和 3.2。
你可以查看 CxxTest 的主页:cxxtest 网站
3
你似乎在使用 Python 3.0,但你的代码还不支持这个版本。最好的办法是先把 Python 降级到 2.6,等到 cxxtestgen.py 能够在 Python 3.0 上正常工作再升级。
想了解更多细节,可以查看这个链接:http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function