Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/JsValue.cpp

Issue 29813591: Issue 6526 - Use Maybe<> version of soon to be deprecated API in v8 6.7 (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Throw on empty value (AsInt() and As Bool()) Created Aug. 7, 2018, 2:36 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/JsValue.cpp ('K') | « src/Utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/JsValue.cpp
===================================================================
--- a/test/JsValue.cpp
+++ b/test/JsValue.cpp
@@ -216,20 +216,20 @@
}
TEST_F(JsValueTest, JsValueCallSingleArg)
{
auto func = GetJsEngine().Evaluate("(function(arg) {return arg * 2;})");
EXPECT_EQ(10, func.Call(GetJsEngine().NewValue(5)).AsInt());
}
-TEST_F(JsValueTest, ThrowingCoversion)
+TEST_F(JsValueTest, ThrowingConversion)
{
const std::string source("\
function Foo() {\
this.toString = function() {throw 'test1';};\
this.valueOf = function() {throw 'test2';};\
};\
new Foo()");
auto value = GetJsEngine().Evaluate(source);
ASSERT_EQ("", value.AsString());
- ASSERT_EQ(0, value.AsInt());
+ ASSERT_ANY_THROW(value.AsInt());
}
« src/JsValue.cpp ('K') | « src/Utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld