Index: test/JsEngine.cpp |
=================================================================== |
--- a/test/JsEngine.cpp |
+++ b/test/JsEngine.cpp |
@@ -45,28 +45,30 @@ public: |
TEST(JsEngineTest, EvaluateAndCall) |
{ |
ThrowingFileReader fileReader; |
ThrowingErrorCallback errorCallback; |
AdblockPlus::JsEngine jsEngine(&fileReader, 0, &errorCallback); |
const std::string source = "function hello() { return 'Hello'; }"; |
jsEngine.Evaluate(source); |
- const std::string result = jsEngine.Evaluate("hello()"); |
- ASSERT_EQ("Hello", result); |
+ AdblockPlus::JsValuePtr result = jsEngine.Evaluate("hello()"); |
+ ASSERT_EQ(true, result->IsString()); |
+ ASSERT_EQ("Hello", result->AsString()); |
} |
TEST(JsEngineTest, LoadAndCall) |
{ |
StubFileReader fileReader; |
ThrowingErrorCallback errorCallback; |
AdblockPlus::JsEngine jsEngine(&fileReader, 0, &errorCallback); |
jsEngine.Load("hello.js"); |
- const std::string result = jsEngine.Evaluate("hello()"); |
- ASSERT_EQ("Hello", result); |
+ AdblockPlus::JsValuePtr result = jsEngine.Evaluate("hello()"); |
+ ASSERT_EQ(true, result->IsString()); |
+ ASSERT_EQ("Hello", result->AsString()); |
} |
TEST(JsEngineTest, LoadBadStreamFails) |
{ |
BadFileReader fileReader; |
ThrowingErrorCallback errorCallback; |
AdblockPlus::JsEngine jsEngine(&fileReader, 0, &errorCallback); |
ASSERT_ANY_THROW(jsEngine.Load("hello.js")); |