|
|
@ -17,7 +17,7 @@ BOOST_AUTO_TEST_CASE(evalInteger) |
|
|
|
JSV8Engine engine; |
|
|
|
JSV8Printer printer(engine); |
|
|
|
auto value = engine.eval("1 + 1"); |
|
|
|
string result = printer.print(value); |
|
|
|
string result = printer.print(value).cstr(); |
|
|
|
BOOST_CHECK_EQUAL(result, "2"); |
|
|
|
} |
|
|
|
|
|
|
@ -26,7 +26,7 @@ BOOST_AUTO_TEST_CASE(evalString) |
|
|
|
JSV8Engine engine; |
|
|
|
JSV8Printer printer(engine); |
|
|
|
auto value = engine.eval("'hello ' + 'world'"); |
|
|
|
string result = printer.print(value); |
|
|
|
string result = printer.print(value).cstr(); |
|
|
|
BOOST_CHECK_EQUAL(result, "hello world"); |
|
|
|
} |
|
|
|
|
|
|
@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(evalEmpty) |
|
|
|
JSV8Engine engine; |
|
|
|
JSV8Printer printer(engine); |
|
|
|
auto value = engine.eval(""); |
|
|
|
string result = printer.print(value); |
|
|
|
string result = printer.print(value).cstr(); |
|
|
|
BOOST_CHECK_EQUAL(result, "undefined"); |
|
|
|
} |
|
|
|
|
|
|
@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(evalAssignment) |
|
|
|
JSV8Engine engine; |
|
|
|
JSV8Printer printer(engine); |
|
|
|
auto value = engine.eval("x = 5"); |
|
|
|
string result = printer.print(value); |
|
|
|
string result = printer.print(value).cstr(); |
|
|
|
BOOST_CHECK_EQUAL(result, "5"); |
|
|
|
} |
|
|
|
|
|
|
@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(evalIncorrectExpression) |
|
|
|
JSV8Engine engine; |
|
|
|
JSV8Printer printer(engine); |
|
|
|
auto value = engine.eval("["); |
|
|
|
string result = printer.print(value); |
|
|
|
string result = printer.print(value).cstr(); |
|
|
|
BOOST_CHECK_EQUAL(result, "Error: Uncaught SyntaxError: Unexpected end of input"); |
|
|
|
} |
|
|
|
|
|
|
@ -62,8 +62,8 @@ BOOST_AUTO_TEST_CASE(evalNull) |
|
|
|
JSV8Engine engine; |
|
|
|
JSV8Printer printer(engine); |
|
|
|
auto value = engine.eval("null"); |
|
|
|
string result = printer.print(value); |
|
|
|
string prettyResult = printer.prettyPrint(value); |
|
|
|
string result = printer.print(value).cstr(); |
|
|
|
string prettyResult = printer.prettyPrint(value).cstr(); |
|
|
|
BOOST_CHECK_EQUAL(result, "null"); |
|
|
|
BOOST_CHECK_EQUAL(prettyResult.find("null") != std::string::npos, true); |
|
|
|
} |
|
|
|