fixed natspec evaluator result on error

This commit is contained in:
Marek Kotewicz 2015-02-05 18:45:37 +01:00
parent d3dd2972c1
commit 1954c0686d

View File

@ -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()