首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为单元测试安装Google测试

为单元测试安装Google测试
EN

Stack Overflow用户
提问于 2012-06-21 06:06:11
回答 1查看 499关注 0票数 3

我目前正在开发JavaScript,并希望为JavaScript设计单元测试,我使用的是google test。

http://code.google.com/p/google-js-test/

我下载了gjstest-1.0.7

我已经安装了所需的所有先决条件。

http://code.google.com/p/google-js-test/wiki/Installing#Prerequisites

但是当我安装google js测试时,使用

代码语言:javascript
复制
$ cd gjstest-1.0.7 
$ make

我有以下错误

代码语言:javascript
复制
g++ -DHASH_NAMESPACE=__gnu_cxx -lrt -I. -I/usr/include/libxml2 -DDEFAULT_DATA_DIR=/usr/local/share/gjstest  -c -o gjstest/internal/cpp/v8_utils.o gjstest/internal/cpp/v8_utils.cc
gjstest/internal/cpp/v8_utils.cc:33: error: ‘v8::StackFrame’ has not been declared
gjstest/internal/cpp/v8_utils.cc:34: error: ‘v8::StackTrace’ has not been declared
gjstest/internal/cpp/v8_utils.cc: In function ‘void gjstest::ConvertToStringVector(const v8::Handle<v8::Value>&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*)’:
gjstest/internal/cpp/v8_utils.cc:60: error: no matching function for call to ‘v8::Array::Get(uint32&)’
/usr/include/v8.h:1161: note: candidates are: v8::Local<v8::Value> v8::Object::Get(v8::Handle<v8::Value>)
make: *** [gjstest/internal/cpp/v8_utils.o] Error 1

看来v8的安装不正确

我使用以下命令安装了V8

代码语言:javascript
复制
sudo apt-get install libv8-2.0.3 
sudo apt-get install libv8-dbg 
sudo apt-get install libv8-dev 

也可以通过下载

代码语言:javascript
复制
svn checkout http://v8.googlecode.com/svn/trunk/ v8
cd v8
make dependencies
scons

但还是会犯这些错误

因此,如果有人安装和使用Google或安装了v8,请指导我如何解决这个问题。

我正在使用Ubuntu10.04。任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2012-08-27 20:08:53

这确实是因为试图针对一个非常老版本的libv8构建gjstest。

我在ubuntu10.04上签出并构建了一个最新的libv8,按照这里的说明

代码语言:javascript
复制
svn checkout http://v8.googlecode.com/svn/trunk/ v8
cd v8
make depdendencies
make native library=shared
cp out/native/lib.target/libv8.so /usr/local/lib/libv8.so
cp include/v8.h /usr/local/include/v8.h
cp include/v8stdint.h /usr/local/include/v8stdint.h

之后,gjstest编译并运行,没有进一步的意外。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11132430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档