Index: test/JsValue.cpp |
=================================================================== |
--- a/test/JsValue.cpp |
+++ b/test/JsValue.cpp |
@@ -12,23 +12,32 @@ |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
#include "BaseJsTest.h" |
+#include "../src/Utils.h" |
+ |
namespace |
{ |
class JsValueTest : public BaseJsTest |
{ |
}; |
} |
+TEST_F(JsValueTest, Checked) |
+{ |
+ auto value = v8::MaybeLocal<bool>(); |
+ ASSERT_ANY_THROW(CHECKED_TO_LOCAL(GetJsEngine().GetIsolate(), |
+ std::move(value))); |
+} |
+ |
TEST_F(JsValueTest, UndefinedValue) |
{ |
auto value = GetJsEngine().Evaluate("undefined"); |
ASSERT_TRUE(value.IsUndefined()); |
ASSERT_FALSE(value.IsNull()); |
ASSERT_FALSE(value.IsString()); |
ASSERT_FALSE(value.IsBool()); |
ASSERT_FALSE(value.IsNumber()); |
@@ -156,16 +165,17 @@ |
ASSERT_EQ(2, value.GetProperty("x").AsInt()); |
value.SetProperty("x", 12); |
ASSERT_EQ(12, value.GetProperty("x").AsInt()); |
value.SetProperty("x", GetJsEngine().NewValue(15)); |
ASSERT_EQ(15, value.GetProperty("x").AsInt()); |
ASSERT_EQ("Foo", value.GetClass()); |
ASSERT_EQ(3u, value.GetOwnPropertyNames().size()); |
ASSERT_ANY_THROW(value.Call()); |
+ ASSERT_TRUE(value.GetProperty("bar").IsUndefined()); |
} |
TEST_F(JsValueTest, ArrayValue) |
{ |
auto value = GetJsEngine().Evaluate("[5,8,12]"); |
ASSERT_FALSE(value.IsUndefined()); |
ASSERT_FALSE(value.IsNull()); |
ASSERT_FALSE(value.IsString()); |