|
@ -62,7 +62,6 @@ BOOST_AUTO_TEST_CASE(natspec_create_custom_function) |
|
|
// given
|
|
|
// given
|
|
|
NatspecExpressionEvaluator e; |
|
|
NatspecExpressionEvaluator e; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
// when
|
|
|
auto x = e.evalExpression("`test = function (x) { return x + 'ok'; }`"); // ommit var, make it global
|
|
|
auto x = e.evalExpression("`test = function (x) { return x + 'ok'; }`"); // ommit var, make it global
|
|
|
string result = e.evalExpression("`test(5)`").toStdString(); |
|
|
string result = e.evalExpression("`test(5)`").toStdString(); |
|
@ -121,4 +120,18 @@ BOOST_AUTO_TEST_CASE(natspec_js_eval_input_params) |
|
|
BOOST_CHECK_EQUAL(result, "Will multiply 4 by 7 and return 28."); |
|
|
BOOST_CHECK_EQUAL(result, "Will multiply 4 by 7 and return 28."); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(natspec_js_eval_error) |
|
|
|
|
|
{ |
|
|
|
|
|
cnote << "testing natspec evaluation of incorrect input"; |
|
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
|
NatspecExpressionEvaluator e; |
|
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
|
string result = e.evalExpression("`test(`").toStdString(); |
|
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
|
BOOST_CHECK_EQUAL(result, "`test(`"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE_END() |
|
|
BOOST_AUTO_TEST_SUITE_END() |
|
|