summaryrefslogtreecommitdiffstats
path: root/gin/test/gtest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gin/test/gtest.cc')
-rw-r--r--gin/test/gtest.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/gin/test/gtest.cc b/gin/test/gtest.cc
index 422d3ec..254c735 100644
--- a/gin/test/gtest.cc
+++ b/gin/test/gtest.cc
@@ -18,6 +18,16 @@ namespace gin {
namespace {
+void Fail(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ Arguments args(info);
+
+ std::string description;
+ if (!args.GetNext(&description))
+ return args.ThrowError();
+
+ FAIL() << description;
+}
+
void ExpectTrue(bool condition, const std::string& description) {
EXPECT_TRUE(condition) << description;
}
@@ -48,6 +58,8 @@ v8::Local<v8::ObjectTemplate> GTest::GetTemplate(v8::Isolate* isolate) {
data->GetObjectTemplate(&g_wrapper_info);
if (templ.IsEmpty()) {
templ = v8::ObjectTemplate::New();
+ templ->Set(StringToSymbol(isolate, "fail"),
+ v8::FunctionTemplate::New(Fail));
templ->Set(StringToSymbol(isolate, "expectTrue"),
CreateFunctionTempate(isolate, base::Bind(ExpectTrue)));
templ->Set(StringToSymbol(isolate, "expectFalse"),