Index: test/JsEngine.cpp |
=================================================================== |
--- a/test/JsEngine.cpp |
+++ b/test/JsEngine.cpp |
@@ -24,19 +24,19 @@ |
class JsEngineTest : public BaseJsTest |
{ |
}; |
} |
TEST_F(JsEngineTest, Evaluate) |
{ |
jsEngine->Evaluate("function hello() { return 'Hello'; }"); |
- AdblockPlus::JsValuePtr result = jsEngine->Evaluate("hello()"); |
- ASSERT_TRUE(result->IsString()); |
- ASSERT_EQ("Hello", result->AsString()); |
+ auto result = jsEngine->Evaluate("hello()"); |
+ ASSERT_TRUE(result.IsString()); |
+ ASSERT_EQ("Hello", result.AsString()); |
} |
TEST_F(JsEngineTest, RuntimeExceptionIsThrown) |
{ |
ASSERT_THROW(jsEngine->Evaluate("doesnotexist()"), std::runtime_error); |
} |
TEST_F(JsEngineTest, CompileTimeExceptionIsThrown) |
@@ -66,17 +66,17 @@ |
namespace { |
bool IsSame(AdblockPlus::JsEngine& jsEngine, |
const AdblockPlus::JsValue& v1, const AdblockPlus::JsValue& v2) |
{ |
AdblockPlus::JsValueList params; |
params.push_back(v1); |
params.push_back(v2); |
- return jsEngine.Evaluate("f = function(a, b) { return a == b };")->Call(params).AsBool(); |
+ return jsEngine.Evaluate("f = function(a, b) { return a == b };").Call(params).AsBool(); |
} |
} |
TEST_F(JsEngineTest, ValueCopy) |
{ |
{ |
auto value = jsEngine->NewValue("foo"); |
@@ -184,13 +184,13 @@ |
jsEngine->SetWebRequest(webRequest); |
ASSERT_EQ(webRequest, jsEngine->GetWebRequest()); |
} |
TEST(NewJsEngineTest, GlobalPropertyTest) |
{ |
AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New()); |
jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar")); |
- AdblockPlus::JsValuePtr foo = jsEngine->Evaluate("foo"); |
- ASSERT_TRUE(foo->IsString()); |
- ASSERT_EQ(foo->AsString(), "bar"); |
+ auto foo = jsEngine->Evaluate("foo"); |
+ ASSERT_TRUE(foo.IsString()); |
+ ASSERT_EQ(foo.AsString(), "bar"); |
} |